Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to call a javascript function on radio button's 'checked' property?
    primarykey
    data
    text
    <p>I have N number of radio button groups in the page with auto generated names.</p> <p>I want to call a javascript function as the value of the checked property. <strong>THIS LINE EXCLUDED AFTER EDIT</strong> ( Depending on the return value, the radio button needs to be checked or unchecked.)</p> <pre><code>&lt;input type="radio" name="auto_generated_name" value="some_value" checked="test_check(args);" /&gt; </code></pre> <p>and the javascript function is</p> <pre><code>function test_check(params) { if(conditions){ return true; } else return false; } </code></pre> <p>But that does not work. Whatever value I assign to 'checked' property, be it any javascript function or any string etc, the radio button becomes checked.</p> <p>How can I achieve my goal?</p> <p>EDIT:</p> <pre><code> &lt;input type="radio" name="auto_generated_name" value="somevalue" onclick="test_check(args)"/&gt; </code></pre> <p>4 radio buttons make a group. such N radio groups have html class names in this way : button_group_1, button_group_2, button_group_3, button_group_4 etc.</p> <p>The 'args' need to be these class (i.e. radio button group) names and the corresponding values (from value="1", value="2", value="3" and value="4" ). </p> <p>Cookies with the class names and values will be created inside the javascript function.</p> <p>On page refresh, cookies matching with the class names will be checked and depending on the existence of the corresponding cookies, the radio button will be checked or unchecked.</p> <p>How to achieve the goals/</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload