Opened 8 years ago

Closed 7 years ago

#7779 closed bug (duplicate)

datepicker doesn't handle inputs with single quotes in id

Reported by: alh84001 Owned by:
Priority: minor Milestone: 1.11.0
Component: ui.datepicker Version: 1.8.16
Keywords: Cc:
Blocked by: Blocking:

Description

Example of this is on http://jsfiddle.net/h9G3v/4/

There is no way to pick a date on second and third input field. You can invoke the datepicker, but if you press on any field, nothing happens.

I pinpointed this to _generateHtml() method, line:

(unselectable ? '' : ' onclick="DP_jQuery_' + dpuuid + '.datepicker._selectDay(\'#' + inst.id /* etc */;

inst.id string can't be pasted directly into selector because it contains only two slashes, which basically just escapes the slash, and does not escape the single quote. If the inst.id is modified to have three slashes before the quote than the selector works as expected.

jQuery version: tested on 1.4.2, 1.6.4, browsers: IE 9, Firefox 4, OS: Win 7

Change History (4)

comment:1 Changed 8 years ago by ghostd

Hi,

I put your example in a local file on my box, and i get a date picker for each input with FF 7 (linux).

comment:2 Changed 8 years ago by Scott González

Status: newopen

@ghostd, the problem occurs when you select a date, not when you focus the text field.

comment:3 Changed 7 years ago by Scott González

Milestone: 1.9.01.11.0

comment:4 Changed 7 years ago by tj.vantoll

Resolution: duplicate
Status: openclosed

Duplicate of #8480.
This was fixed with https://github.com/jquery/jquery-ui/commit/b92965a78121534c113b1d717a75cee728548520 in 1.8.23.

You can see the issue here - http://jsfiddle.net/tj_vantoll/3xGUp/. If you uncomment the master branch files this works fine.

Note: See TracTickets for help on using tickets.