cannot pass a variable to selector
I am trying to use (multiple) attribute selector and I have a string variable "txt" that I need to use in the attribute selector to select all <p> with all id's except for the id=txt
$(document).ready(function(){
$("p.par").click(function(){
txt = $(this).attr("id");
txt="#name"+txt;
$("p[id!=txt]").show();
})
})
so basically it treats my variable "txt" as some string to compare the ids against. I've tried different ways, but I cannot make it work as an actual variable
Thanks!
Dima