timcharper / calendar_date_select

A previously popular but no longer maintained JavaScript DatePicker for RubyOnRails (and others)
http://code.google.com/p/calendardateselect/
Other
409 stars 179 forks source link

Using $(this).previous in the onclick handler can lead to errors if other JS is manipulating the DOM structure. #10

Open leecunliffe opened 14 years ago

leecunliffe commented 14 years ago

For example, In one form I use LiveValidation to validate the dates. This JS creates a span after the input. Then when I click to launch the date picker, the JS errors because $(this).previous is the span and not the expected input element.

Solution: use the unique ID to identify the input field.