Reputation: 7906
I have a function like this... I am trying to insert a class name using a variable gotValue
. How do I pass it in jQuery? I have tried that in if clause, but it did not work.
function fullData(gotValue)
{
alert(gotValue);
var count = gotvalue.substring(9);
if($('.'+gotValue+'').is(':checked'))
{
alert('working');
}
}
Upvotes: 0
Views: 309
Reputation: 14779
It's not that clear what you're trying to do but I think what you want is
$('.'+gotValue+":checked")
Upvotes: 0
Reputation: 382909
Javascript variables are case-sensitive; so:
gotValue != gotvalue
Upvotes: 6