How to pass input text as parameter in javascript onblur event?

This is the code for entering a text field. I want to call the function "checkDateFormat" with text input as a parameter when the user leaves the field.

Here is the code I wrote:

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 am sure that the function is not even being called.

What am I doing wrong?

+4
source share
2 answers

Try using

 onblur="checkDateFormat(this.value)" 

Instead

 onblur="checkDateFormat(this.date_t.value)"
+10
source

Give it a try checkDateFormat(this.value).

+1
source

All Articles