Reputation: 1777
How to use multiple different id with a variable of ID value? It don't show any error or output
function show_div(id)
{
$("#edit_li"+id, "#save_li"+id).show();
}
Upvotes: 2
Views: 174
Reputation: 102
function show_div(id)
{
$("#edit_tag"+id+",#save_li"+id).show();
}
The variable to be placed between + , while using within string.
Upvotes: 2
Reputation: 32354
Always append and prepend your variables with +
when they are in a string
function show_div(id)
{
$("#edit_tag"+id+",#save_li"+id).show();
}
Upvotes: 1
Reputation: 148120
You need to put ,
in selector as well as the comma outside mean you have two parameters in the selector instead of separating ids in selector.
$("#edit_tag"+id ", #save_li"+id).show();
Upvotes: 1
Reputation: 115222
Comma separate multi-selector, not as parameter
function show_div(id)
{
$("#edit_tag"+id+ ",#save_li"+id).show();
// --^--
}
REF : Multiple-selector
Upvotes: 1