Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Find all textfield using JQuery

Tags:

jquery

I have a jsp page in which I add dynamically more textfields. The ids of those textfields are something like this: textfield1, textfield2, ..., textfieldn. I have a button which saves all of the values of the textfields. But first I want to check if some of the textfields have values in them. How can I check using JQuery all the textfields starting with 'textfield'?

like image 363
tinti Avatar asked Apr 14 '26 15:04

tinti


1 Answers

$('[id^="textfield"]').each(function(index, item){
       //do something with each one
})
like image 64
Naftali Avatar answered Apr 16 '26 05:04

Naftali



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!