<%:Html.TextBox("NumTotal1, 0, new { id =1 , title="test"})%>
<%:Html.TextBox("NumTotal2, 0, new { id =2 , title="test"})%>
<%:Html.TextBox("NumTotal3, 0, new { id =3 , title="test"})%>
I want to sum value of texbox with title=”test” attribute using JQUERY?
How can I? Please help me
You can use the attribute-equals selector (
[attr=val]) to get your textboxes, then use.each()to loop through and get your total, like this:But these are fairly expensive compared to other selectors, so with a large number of elements I recommend giving your inputs a common class, making them less expensive to find.