This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Assign Two Methods at a Time

 
ramnna jain
Ranch Hand
Posts: 129
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

In my javascript code I want to assign two methods at a time:



I want to set another function 'checkAvailability()' on 'onblur', but how ... please any buddy can help me..!

Thank you.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65118
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't when using Model 0 event handling.

You'll need to either:
  • enclose the two functions in the inline function
  • use DOM Model 2 event handling (warning! browser-specific minefield ahead)
  • user a library like jQuery that makes this easy

  • You're already enclosing the call to one function in an inline anonymous function, just add a second call.
     
    Bear Bibeault
    Author and ninkuma
    Marshal
    Pie
    Posts: 65118
    89
    IntelliJ IDE Java jQuery Mac Mac OS X
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    For option 1 above:

     
    ramnna jain
    Ranch Hand
    Posts: 129
    Java
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thank you Bear... with your help the problem is solved... thank you again.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic