Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery custom checkbox - graphic update not working
    primarykey
    data
    text
    <p>Trying to set a custom checkbox value when the form loads. Debug tells me the checkbox reflects the value loaded from a source but the custom graphic won't update.</p> <p>In my form I have</p> <pre><code>&lt;input class="checkbox" type="checkbox" name="uitem_autorenew" id="uitem_autorenew" /&gt; </code></pre> <p>Style I have: </p> <pre><code> .checkbox { display: none; } .toggle { background: url("toggle.png") bottom left; display: block; width: 70px; height: 22px; } .toggle.checked { background-position: top left; } </code></pre> <p>Code includes the following</p> <pre><code> $(document).ready(function() { $('.checkbox').after(function() { if ($(this).is(":checked")) { return "&lt;a href='#' class='toggle checked' ref='" + $(this).attr("id") + "'&gt;&lt;/a&gt;"; } else { return "&lt;a href='#' class='toggle' ref='" + $(this).attr("id") + "'&gt;&lt;/a&gt;"; } }); </code></pre> <p>...into the dialog which has an open event... definitely setting the check or uncheck feature according to the data</p> <pre><code> var ar=$(this).data('renew'); console.log("Value of ar = " + ar); // which is Y if (ar =="Y"){ $("#uitem_autorenew").prop('checked',true); // tried this $("#uitem_autorenew").toggleClass("checked"); //tried this too } console.log ("Is checkbox checked?"); console.log ($("#uitem_autorenew").prop('checked')); // yes it is but the graphic has not toggled. Top left of toggle.png is has word "YES" </code></pre> <p>I'm just wondering what I am missing in the case that the style has not changed. Any clues welcomed and thanks in advance. Kevin</p>
    singulars
    1. This table or related slice is empty.
    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.
    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