GeeCON Prague 2014*
The moose likes HTML, CSS and JavaScript and the fly likes HTML Input onClick event Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "HTML Input onClick event" Watch "HTML Input onClick event" New topic
Author

HTML Input onClick event

Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1460
    
    1
I have an input tag on my page with an onClick event attribute. For some reason it has to be clicked twice before the function will fire. It is like the first click sets it's focus so the second click get a handle to is attributes.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61306
    
  66

Why do you need a click event versus a focus event?


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Steve Dyke
Ranch Hand

Joined: Nov 16, 2004
Posts: 1460
    
    1
Bear Bibeault wrote:Why do you need a click event versus a focus event?


Never thought about that I always used onclick.

However, I have changed to drop down style list instead of displaying another page to give name list. It looks a whole lot cleaner. I am learning as I go.

But I could not do this without the help you have given.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61306
    
  66

Thanks.

Also, do give thought about what event might be the post appropriate to capture. A lot of people just default to click when at times, focus or change might be more appropriate.

For example, do you think that the click on a dropdown is what's important? Or is the important event the fact that the value has changed?
 
GeeCON Prague 2014
 
subject: HTML Input onClick event