Bug Tracker

Opened 9 years ago

Closed 9 years ago

#6600 closed bug (worksforme)

Jquery - selector not selecting Id's when having periods in IE, even when perios id escaped with \\

Reported by: Jkb Owned by:
Priority: undecided Milestone: 1.4.3
Component: selector Version: 1.4.2
Keywords: selector IE periods Cc:
Blocked by: Blocking:

Description

In IE, The selector for multiple inputs is not working whereas in firefox it is. Below is the html.

<td><input id="contactInfo.shippingAddress.city" name="contactInfo.shippingAddress.city" onchange="needToConfirm = true;" type="text" value="city" maxlength="100"/></td>

If selector is written as $("*[id='contactInfo
.shippingAddress']").val("");

It doesn't work

But if written as $("*[id='contactInfo.shippingAddress']").val(""); - it works..

But jquery documentation says, periods must be escaped with

Reference -> http://forum.jquery.com/topic/jquery-selector-not-selecting-multiple-checkboxes-ie

Attachments (1)

try2.htm (1.3 KB) - added by Jkb 9 years ago.
selector not working when id containing period is escaped

Download all attachments as: .zip

Change History (2)

Changed 9 years ago by Jkb

Attachment: try2.htm added

selector not working when id containing period is escaped

comment:1 Changed 9 years ago by addyosmani

Priority: undecided
Resolution: worksforme
Status: newclosed

In the above test case, it's not necessary to escape the ID in order to create a selector that can select all of the relevant elements desired. Although a period is present, this can be easily handled using a more advanced selector such as this: http://jsfiddle.net/65DKY/1/

As you can see, this handles multiple elements without any problem.

Just to confirm as well: Using the correct selector (as provided above) you *can* still escape the periods if needed without any loss in functionality.

http://jsfiddle.net/65DKY/2/

Closing as this should be resolved now.

Note: See TracTickets for help on using tickets.