Skip to main content

Search and Top Navigation

#7779 closed bug (duplicate)

Opened October 10, 2011 02:04PM UTC

Closed December 06, 2012 08:08PM UTC

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

Attachments (0)
Change History (4)

Changed November 08, 2011 02:20PM UTC by ghostd comment:1

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).

Changed November 08, 2011 02:25PM UTC by scottgonzalez comment:2

status: newopen

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

Changed October 11, 2012 02:43PM UTC by scottgonzalez comment:3

milestone: 1.9.01.11.0

Changed December 06, 2012 08:08PM UTC by tj.vantoll comment:4

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.