Skip to main content

Bug Tracker

Side navigation

#6600 closed bug (worksforme)

Opened May 26, 2010 10:22AM UTC

Closed October 02, 2010 04:26AM UTC

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 May 26, 2010 10:23AM UTC.

    selector not working when id containing period is escaped

Change History (1)

Changed October 02, 2010 04:26AM UTC by addyosmani comment:1

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.