this is about foreach function in JavaScript/jQuery.
I would like some help with wildcard of an input name
example: when any of the inputs' names that starts with 'field_{something}' are clicked.
this is about foreach function in JavaScript/jQuery.
I would like some help with wildcard of an input name
example: when any of the inputs' names that starts with 'field_{something}' are clicked.
Your question isn't very well formatted, but it kind of sounds like you're looking for a wildcard selector.
$("[name^=field_]").click(function() {
//do stuff
});
More at this SO thread.
$("input[name^=field_]").each(function(){
var currentInput = this;
//...do something ...
});