I have a form with the following dynamically added row:
<input type="text" name="statuseffective" id="statuseffective_0" class="datepicker" size="15" sid="0" ordr="0">
<span style="cursor:pointer; text-decoration:underline; margin-bottom:-14px;" onclick="clearDate();">Clear</span>
the name statuseffective with id of statuseffective_0 is a dynamically added row. To keep cracker jacks from entering dates such as 01/01/1752 into my text box, I’m having to make the field readonly using $('.datepicker').datepicker().attr("readOnly", true) since they were ignoring the jquery popup calendar. The default behaviour of datepicker still allows the user to key in dates using the keys – I need to prevent that. since the keys are now disabled, I need a way to allow the user to clear out the dates so I’m adding a “clear” option after the text input field. Since the rows can be dynamically added, how can I obtain the value of the input field just before the clear text? The code shown in the beginning of this post is what I’m working with.
I would take out the inline js and use .live()
for the html
then in your doc ready