I am trying to get all text boxes that have an id that ends in a particular string.
So far I have tried
$("input[id$='Source']").each(function() {
$("input[type=text][id$='Source']").each(function() {
and also
$("input[type=text] , [id$='Source']").each(function() {
none of these seem to work, could some one maybe point me in the right direction.
I have tried clearing my web browsers cache just to make sure it was not caching any old code.
This works:
<input type="text" id="mysource">
<input type="text" id="yoursource">
<input type="text" id="nope">
js (the context 'this' inside of the each function will be the matched elements):
$("input[type='text'][id$='source']").each(function() {
console.log(this);
});
console result:
<input type="text" id="mysource">
<input type="text" id="yoursource">
Clean up your quotes and you should be OK -
$('input[id$="Source"]').each(function() {
$('input[type="text"][id$="Source"]').each(function() {
Here is an example fiddle - http://jsfiddle.net/C5v4H/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.