Bug Tracker

Opened 13 years ago

Closed 12 years ago

#6379 closed bug (worksforme)

Unable to use the attibute selector with a numeric attribute

Reported by: redlava Owned by:
Priority: undecided Milestone: 1.4.3
Component: selector Version: 1.4.2
Keywords: attribute selector numeric Cc:
Blocked by: Blocking:


I attempted to use the following selector but I was unable to select an object with a numeric attribute such as "1"


If I prefix the value attribute and the selector with a character it works correctly. Do numeric attributes need to be escaped in some way or am I missing something? I am aware that some attributes must not start with a number be I don't believe this is true for the input value attribute.

Change History (3)

comment:1 Changed 13 years ago by redlava

My previous example was actually incorrect, it should have read:


comment:2 Changed 12 years ago by dfens

it works properly

<script language="javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js"></script>
$(document).ready(function() {

  <input value="a" type="text"/>
<input value="1" type="text"/>


comment:3 Changed 12 years ago by addyosmani

Priority: undecided
Resolution: worksforme
Status: newclosed

It would appear that in your original example (as well as in the follow up from a few months ago) you were using incorrect selectors to try selecting both an input with a numeric value as well as an input (of type radio) with a numeric value.

In order to select a radio input element simply use input:radio and you'll be able to do what you're attempting. Similar to what dfens has previously posted, doing this effectively combined with the :radio selector should solve the problem:

input:radio[value=1] for example

Please see here for a Live test case http://jsfiddle.net/6ar5c/

Note: See TracTickets for help on using tickets.