Modify ↓
Ticket #6382 (closed bug: fixed)
.live() not working properly with "has attribute" css selector
| Reported by: | cjoudrey | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | 1.4.3 |
| Component: | selector | Version: | 1.4.2 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description (last modified by jitter) (diff)
There appears to be a problem with .live() and "has attribute" css selector when using forms.
Using the following HTML:
<span title="test">1234</span>
<form>
<input type="text" name="title" />
</form>
When you run $('[title]'), the span element is returned.
However, if you use the following:
$('[title]').live('click', function() {
alert('clicked a [title]');
});
When you click on the input an alert occurs. The selector [title] returns the <form>.
Reproduced in Firefox 3.6.
Change History
comment:3 Changed 2 years ago by anonymous
I think I'm understanding the question correctly, but was not able to replicate the problem here: http://jsfiddle.net/dBsr4/
Clicking on the second input does not return the 'item clicked' alert.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

This is actually due to the fact that the names of input elements become properties of the form that contains them.
http://yura.thinkweb2.com/domlint/