Side navigation
#10457 closed bug (worksforme)
Opened October 08, 2011 01:56PM UTC
Closed October 09, 2011 08:34AM UTC
jQuery Incorrectly Parses Form Variable Names Containing # Character and [array]
Reported by: | carlroett@gmail.com | Owned by: | carlroett@gmail.com |
---|---|---|---|
Priority: | low | Milestone: | None |
Component: | selector | Version: | 1.6.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Given the following general structure, embedded inside a web page with a form, etc. Testing in FireFox 7.0.1 with jQuery v1.6.1
<table class="form-table targetOne">
<tr>
<th valign="top">Location</th>
<td>
<label>
<input type="radio" value="page" name='foo#bar[baz]' checked='checked' />Page </label>
<label>
<input type="radio" value="profile"
name='foo#bar[baz]' />Profile
</label>
<label>
<input type="radio" value="tab"
name='foo#bar[baz]' />Tab </label>
</td>
</tr>
</table>
jQuery("input[name=foo#bar[baz]]:checked").val();
...returns "undefined", when it should return the value of the currently selected radio button.
Changing the "name" in the form to match...
jQuery("input[name=foo#bar]:checked").val(); WORKS
jQuery("input[name=foo[baz]]:checked").val(); WORKS
jQuery("input[name=foo@bar[baz]]:checked").val(); WORKS
But the # character combined with a sub-array causes jQuery to fail.
Attachments (0)
Change History (4)
Changed October 08, 2011 04:49PM UTC by comment:1
_comment0: | Have you tried putting the mandatory quotes around the attribute value? → 1318092599446588 |
---|---|
component: | unfiled → selector |
owner: | → carlroett@gmail.com |
status: | new → pending |
Changed October 08, 2011 04:53PM UTC by comment:2
status: | pending → new |
---|
Replying to [comment:1 rwaldron]:
Have you tried escaping the special character and putting the mandatory quotes around the attribute value?
Please post an example of what you're referring to.
Changed October 08, 2011 05:26PM UTC by comment:3
status: | new → pending |
---|
Changed October 09, 2011 08:34AM UTC by comment:4
priority: | undecided → low |
---|---|
resolution: | → worksforme |
status: | pending → closed |
Escaping the '#' character solves this: http://jsfiddle.net/GQeGW/
Have you tried escaping the special character and putting the mandatory quotes around the attribute value?