سؤال

I have this code:

onblur="(if(this.value==''){this.value=this.title});validateText(this.value);"

I'm trying to to combine an if statement and a function call inside the onblur event, and as you guessed it it is not working. Is this even possible? if yes then how? since if i will create another function for the if it will take me more time since i need to assign id's again where in that way i can just easily change the value.

how will i work my way to solve this problem? any suggestion is very much welcome.

thank you

هل كانت مفيدة؟

المحلول

Just get rid of the parentheses:

onblur="if(this.value==''){this.value=this.title};validateText(this.value);"
       ^^             no parentheses            ^^
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top