So I got stuck with the problem of counting the text fields with ids like ‘field1’, ‘field2’, ‘field3’ etc.
<input id='field1' name='somename_one'/> <input id='field2' name='somename_two'/> <input id='field3' name='somename_three'/>
I need to get the count of such dynamically generated fields. With JQuery, it can be done
simply with the following statement:
This statement will count the number of input fields with ids starting with ‘field’ word.
Lets say you also want to get the entered value in one of those text fields. Simple!
Also if you want the count of empty text fields with id like ‘field1’, ‘field2’, you could do it as follows:
JQuery – Shorter the better!