Reputation: 75
First I'd like to say that I saw an answer for this question on stackoverflow (mentioned down) but it didn't solve my problem. for some reason the thisone variable at the bottom does not hide the element. I also tried $("'#" + thisone + "'"), but it also didn't work. However, alert shoes the correct id value (kida), and when I just replace thisone with $('#kida') it works. What is wrong?
$('input').click(function() {
var thisone = this.id;
var flname = this.alt.split(" ").splice(0, 2).join(" ");
$("#pop").show(500);
$("#fields").click(function() {
if ($("#field").val() == "ani") {
$('#pop').hide();
alert(thisone);
$(thisone).hide();
}
})
});
Upvotes: 0
Views: 61
Reputation: 518
I also tried $("'#" + thisone + "'"), but it also didn't work.
You don't need single quotes here before hash and after the id. Just write:
$("#" + thisone)
Upvotes: 1