How can I use a variable inside jquery id selector?
function more_comments(x){
var datalist = "#s" + x;
$('datalist li:hidden').slice(0, 2).show();
}
I've tried this
var datalist = "s" + x;
$('#datalist li:hidden').slice(0, 2).show();
and this.
$('#s' + x li:hidden').slice(0, 2).show();
If i manually write
$('#s50 li:hidden').slice(0, 2).show();
and click on the tag with an id == s50, it works perfectly. I searched for the correct syntax and can't find it. Thanks for any help.