Bug Tracker

Opened 13 years ago

Closed 13 years ago

#6707 closed bug (invalid)

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.

Change History (1)

comment:1 Changed 13 years ago by dmethvin

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.

Note: See TracTickets for help on using tickets.