aspose file tools
The moose likes HTML, CSS and JavaScript and the fly likes Which javascript method is best to call on Radio button value change? Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply Bookmark "Which javascript method is best to call on Radio button value change?" Watch "Which javascript method is best to call on Radio button value change?" New topic
Author

Which javascript method is best to call on Radio button value change?

Santhosh Kalisamy
Ranch Hand

Joined: Apr 15, 2008
Posts: 55
Hi,

I do have a radio button (using Struts2 tag) with 2 possible values.



Right now, I want to call javascript method incomeFundsToChange() whenever the value is changed on Radio button from Yes --> No [or] No --> Yes.

Which Javascript method is best? I am bit confused, which to use.

I tried with onchange, it works only sometime like, when I click outside of the radio button...etc.

Which event method (like onchange, onmouseup..etc) is better to use? so it will be called, whenever there is a change on Radio button value!

Thanks in Advance.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56201
    
  13

Please do not post server-side markup; it is not useful in this forum. Be sure to post the actual HTML that is generated. That's what the browser and JavaScript operate upon.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Santhosh Kalisamy
Ranch Hand

Joined: Apr 15, 2008
Posts: 55
will do. Thanks.

I thought, it is a simple question to understand. anyhow, I found the answer.

onclick method is the best one to use, when you want to capture the changed value on change event.

onchange is called only when the element loose the focus.

Thank you for looking. closing the thread.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Which javascript method is best to call on Radio button value change?
 
Similar Threads
struts 2 s:radio tag
How to call onload() from Datatable
radio button in struts 2
how to invoke method based on radio button select
How can I disable a text input field?