Reputation: 3535
Here is the problem. I have multiple tag forms in my page. They are supposed to be independent but there's a weird behaviour. If i write in the first form or do any other action and then i press the "X" on a tag of the second form, it doesn't noticed i'm working on a different form. I try to explain it better: if i press X while working in a form,
$(this).attr('id')
return the correct id. The same code returns a wrong id if i press X while working on the other form. Obviously it returns the id of the form I'm working on.
I think the problem is related to some weird focus condition (the keyboard is on a form while the mouse pointer click in another form). How am i supposed to solve that?
EDIT: form's html
<form>
<input id="tagbox_infodisc_discussion_65" class="tag_field" object_type="infodisc_discussion" object_id="65" owner="Infodisc" owner_id="1" cancreatetag="1" canaddtag="1" canremovetag="1" value="['hi mom','efaefea']" $type="text" style="display: none; "><div id="tagbox_infodisc_discussion_65_tagsinput" class="tagsinput"><span class="tag"><span>hi mom </span><a href="#" title="Removing tag">x</a></span><span class="tag"><span>efaefea </span><a href="#" title="Removing tag">x</a></span><div id="tagbox_infodisc_discussion_65_addTag"><input id="tagbox_infodisc_discussion_65_tag" value="" data-default="" style="color: rgb(0, 0, 0); " class="ui-autocomplete-input" autocomplete="off" role="textbox" aria-autocomplete="list" aria-haspopup="true"></div><div class="tags_clear"></div></div>
</form>
Upvotes: 0
Views: 163
Reputation: 87073
try this:
$('input').live('click', function(){
console.log($(this).prop('id'));
});
Upvotes: 1