Sunday 2 September 2018

javascript - How to display an output depending on the selected radio button after selecting a radio button?



How to display something on

or after selecting a specific radio button, for example is I have a group of radio button




Interest Value
o 3%
o 5%
o 7%

Amount: 1,450.00


The value of the amount will change depending on the selected radio button. What is the correct method to do this on javascript (without jquery)? What is the best DOM event to use on it?



Answer



You can just listen to its click event.



See the code here on jsfiddle shamlessly copied from OnChange event handler for radio button (INPUT type="radio") doesn't work as one value




3%
5%
7%


Amount:



No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...