I wanted to ask about using a selector from a variable
first i:
function check()
{
$('.info input, .info select').each(function(n, element){
if ($(element).val()=='')
alert('empty');
});
}
and called him in
$('input')change(check);
and they worked great.
But now I want to pass some value to a function to make it dynamic, like
$('input')change(check('.info'));
and changed the function to
function check(sel) {
$(sel +' input, '+ sel + ' select').each(function(n, element){
if ($(element).val()=='')
alert('empty');
});
}
but that will not work. Any help please .. Thanks,
nagut
nagut source
share