Skip to main content

Bug Tracker

Side navigation

#6707 closed bug (invalid)

Opened June 22, 2010 07:32PM UTC

Closed June 23, 2010 02:12AM UTC

Selector does not return element

Reported by: bleepzter Owned by:
Priority: Milestone: 1.4.3
Component: unfiled Version: 1.4.2
Keywords: selectors; selector with hyphen Cc:
Blocked by: Blocking:
Description

In an ASP.NET page I had to display a few products whose id followed the format of "xxxx.xxxx" where "xxxx" was random sequence of letters and numbers generated by the ERP system, all upper case.

For each product I had a text box with Id of "xxxx.xxxx-QTY"

as well as a link with an id of "xxxx.xxxx-ADDTOCART"

When trying to access the $('#xxxx.xxxx-QTY').val() always returned undefined because the selector used could not find the right element.

I double and triple checked to make sure all ID's are unique and indeed that was the case.

I tried document.getElementById('xxxx.xxxx-QTY').value and I got the right value from the text box.

I suspect that internally JQuery uses a regular expression to parse out the selectors and the hyphen in the 'xxxx.xxxx-QTY' string is being removed.

Attachments (0)
Change History (1)

Changed June 23, 2010 02:12AM UTC by dmethvin comment:1

resolution: → invalid
status: newclosed

Sounds like you need to escape the special chars with

\\\\
in the selector string. If you need more help, ask on the forum before opening a bug report.