Modify ↓
Ticket #8641 (closed bug: fixed)
jQuery 1.5.x bug when trying to get fields with names that have points as separator
| Reported by: | gabrielmoreira@… | Owned by: | |
|---|---|---|---|
| Priority: | undecided | Milestone: | 1.next |
| Component: | unfiled | Version: | 1.5.1 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
This sample works on 1.4.x
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
</head>
<body>
<input type='text' name='foo.bar'/>
<script>
$(document).ready(function() {
console.log($('*[name=foo.bar]'));
});
</script>
</body>
</html>
But doesn't work on 1.5.x
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js"></script>
</head>
<body>
<input type='text' name='foo.bar'/>
<script>
$(document).ready(function() {
console.log($('*[name=foo.bar]'));
});
</script>
</body>
</html>
Change History
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.

As you can see from the docs ( http://api.jquery.com/attribute-equals-selector/), quotes are mandatory for attribute selectors. This has always been the case, but did work in 1.4, and now has been fixed. Attribute selectors that are only one word will still work, but any selectors separated by period or a space or certain other breaks will fail. See http://jsfiddle.net/timmywil/X8MwL/