Jquery - Count Similar Data Fields/class Name In Html Form
I want to get the count of data-fields in HTML form using JavaScript or jQuery ).length;
alert (x);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<input data-table="assessment_rating" data-field="x_PERFORMANCE_MEASURE"
name="x1_PERFORMANCE_MEASURE" id="x1_PERFORMANCE_MEASURE"
placeholder="Performance Measure"
value="" class="form-control" type="text">
Of course since your example didn't include the original
#ewTableHeaderCell
table header cell, I've omitted it out of my snippet. But you get the idea. in your case it is:
var x = $('#ewTableHeaderCell input[data-field="x_PERFORMANCE_MEASURE"]').length;
Since jquery uses css selectors
under the hood, click the link to learn more.
Post a Comment for "Jquery - Count Similar Data Fields/class Name In Html Form"