HTML Code:
<html> <tr><td colspan="2"> <span id="labelMsgForRadioClick">Select your choice</span> </td> </tr> <tr> <td> <input type="radio" value="hagh" checked="checked" name="reg">حقیقی</input> </td> <td> <input type="radio" value="hogh" name="reg">حقوقی</input> </td> </tr> </table>
jQuery /JavaScript Code:
$('input[name=reg]').change(function() { switch ($('input[name=reg]:checked').val()) { case 'hagh': $('#labelMsgForRadioClick').text('first radio was clicked'); break; case 'hogh': $('#labelMsgForRadioClick').text('second radio was clicked'); break; default: $('#labelMsgForRadioClick').text('select your choice'); } });
See it in working ( click on Result tab) -
Happy Bakrid to all of you !!!
0 comments :
Post a Comment