Are you using <span> or <div> tag instead of using <label>? Well you are not alone.
for the longest time whenever I wanted to use radio button, checkbox, textbox, or textarea i used <span> tag, I also used add “onclick” on span when ever I used it with radiobox or checkbox so it would give check or uncheck in the case user click on <span> tag
<input id="rdoTentative" type="radio" name="confirmtype" value="T" /><span onclick="document.getElementById('rdoTentative').checked = true;">Tentative</span>
But instead this little tag takes care of onclick event for me when using <label>
<input id="rdoTentative" type="radio" name="confirmtype" value="T" /><label for="rdoTentative">Tentative</label>
or you can do following
<label><input id="rdoTentative" type="radio" name="confirmtype" value="T" />Tentative</label>
for more detailed reading please visit W3CSchool site.
No comments:
Post a Comment