In HTML, What's the purpose of the attribute for in the label tag.
<label for = "Name">Name: </label> <% = Html.TextBox("Name")%>
In the above sample, why the label tag has a for = "Name" attribute? To mark their association??? If I don't put for what gonna happen?
Thanks for helping
Using HttpContext.Current.Application to store simple data
1:Cant open Nerd Dinner 1.0 VS 2008 SP1 MVC 2
TheHow to access model in jqueryIs it possible for a Master page to access Controller properties?
forattrialthough e specifies which form element the label is bound to.. After using Automapper to map a ViewModel how and what should I test? The
labelelement allows the user to commit focus to a form element by clicking on an associate label. How to map table records to Any type using Castle ActiveRecordIf you did not use the
forattrialthough e, this association will not be made.. Why do I get a TypeInitializationException when calling HtmlHelper.AntiForgeryToken?
2:ASP.NET MVC - Wordpress Style URLs
If the user clicks on the
label, and the
forattrialthough e matches this
idof the respective control, it will toggle the control..
If you click on the label, you may for instance check or uncheck a checkbox / radio although ton. The
forattrialthough e tells what checkbox the label belongs to.. A complete case is available at http://www.w3schools.com/tags/tag_label.asp..
You must accomplish the same thing by including the form element within the "bound" label element. It's nice when you can't or don't want to commit IDs to your elements..
<label> My Label <input type="checkbox" /> </label>