Opened 7 years ago

Closed 7 years ago

Last modified 2 years ago

#8403 closed bug (notabug)

Datepicker href Problem

Reported by: jeremy Owned by: jeremy
Priority: minor Milestone: 1.9.0
Component: ui.datepicker Version: 1.8.21
Keywords: Cc:
Blocked by: Blocking:

Description

If you click on a day TD in the latest version of the datepicker with Internet Explorer, Internet Explorer will cheerfully process the onclick attribute on the TD ... and then go on to process the default action of the A tag inside the TD, which is to navigate to the href ("#"). This might not be an issue for many sites, but for a Javascript-heavy "thick client" page, which relies on the anchor for navigation, it's a real problem.

This can be fixed simply by changing this line of the date picker's code (inside its _generateHTML method) from:

'" href="#">' + printDate.getDate() + '</a>')) + '</td>'; display selectable date

to:

'">' + printDate.getDate() + '</a>')) + '</td>'; display selectable date

or, if you want to preserve the href attribute (I think some validity checkers expect A tags to always have an href) you could instead use:

'" href="javascript:void(document.close())">' + printDate.getDate() + '</a>')) + '</td>'; display selectable date

Change History (3)

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

Component: ui.coreui.datepicker
Owner: set to jeremy
Status: newpending

I'm not seeing this behavior. Are you experiencing problems on http://view.jqueryui.com/1.8.21/demos/datepicker/default.html ?

comment:2 Changed 7 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

comment:3 Changed 2 years ago by Gimbar

I'm able to reproduce this issue. Clicking on any date overwrites my anchor and resets my application. I don't know wether this matters but the anchor is seperated by a slash directly in front of it.

Note: See TracTickets for help on using tickets.