This is the code for an input text field. What I want is to call the "checkDateFormat" function with the text input as a parameter when the user leaves the field.
Here is the code I've written:
Fecha de prueba: <input type="text" name="date_t" id="date_t" value="22/08/2014" onblur="checkDateFormat(this.date_t.value)"><br>
However I'm sure the function isn't even called.
What am I doing wrong?
This is the code for an input text field. What I want is to call the "checkDateFormat" function with the text input as a parameter when the user leaves the field.
Here is the code I've written:
Fecha de prueba: <input type="text" name="date_t" id="date_t" value="22/08/2014" onblur="checkDateFormat(this.date_t.value)"><br>
However I'm sure the function isn't even called.
What am I doing wrong?
Share Improve this question asked Aug 14, 2014 at 11:01 aarelovichaarelovich 5,56615 gold badges64 silver badges123 bronze badges 3 |2 Answers
Reset to default 16Try to use,
onblur="checkDateFormat(this.value)"
Instead of
onblur="checkDateFormat(this.date_t.value)"
Try checkDateFormat(this.value)
instead.
this.value
. That's all. – emerson.marini Commented Aug 14, 2014 at 11:03this.value
it will pass the value in the textbox on the event – Murtaza Commented Aug 14, 2014 at 11:03onblur="checkDateFormat(this.date_t.value)"
toonblur="checkDateFormat(this.value)"
– Waldo Jeffers Commented Aug 14, 2014 at 11:03