aarelovich
aarelovich

Reputation: 5566

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

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?

Upvotes: 7

Views: 27701

Answers (2)

Shijin TR
Shijin TR

Reputation: 7768

Try to use,

 onblur="checkDateFormat(this.value)" 

Instead of

 onblur="checkDateFormat(this.date_t.value)"

Upvotes: 16

icke
icke

Reputation: 1578

Try checkDateFormat(this.value) instead.

Upvotes: 1

Related Questions