Reputation: 11990
I am trying to get all inputs that are inside on a div. The inputs cannot be hidden type.
Here is what I have done
$("#MasterContentViewer :input:not([type=hidden])").each(function(e){
var input = $(this);
var name = input.attr('name').toLowerCase();
var tag = $('meta[name="is_attr_' + name + '"]');
if( tag.length ){
tag.val( input.val() );
}
});
That gives me an error in toLowerCase
as it is not a valid property of null
How can I correctly find all inputs inside my MasterContentViewer
div with a type not hidden
?
Upvotes: 1
Views: 46
Reputation: 5953
Like this:
$("#MasterContentViewer input:not(:hidden)").each(function(e){
var input = $(this);
var name = input.attr('name').toLowerCase();
var tag = $('meta[name="is_attr_' + name + '"]');
if( tag.length ){
tag.val( input.val() );
}
});
Upvotes: 2