Opened 12 years ago
Closed 12 years ago
#7720 closed bug (invalid)
Uncaught Syntax error, unrecognized expression: # when using $('#' + var);
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | undecided | Milestone: | 1.6 |
Component: | unfiled | Version: | 1.4.3 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
var $this = $(this); var id = $this.attr('for'); var val = $('#' + id).val();
this throws an Uncaught Syntax error, unrecognized expression: #
Note: See
TracTickets for help on using
tickets.
This is not a jQuery bug. I'd suggest checking the value of
id
before using it in your selector.http://jsfiddle.net/rwaldron/XYQXr/