Note that there are some explanatory texts on larger screens.

plurals
  1. POchange: function (event, ui) to uncheck a checked checkbox in jquery not working
    primarykey
    data
    text
    <p>I made a simple script in Jquery which has a range of text-boxes with auto-completes. When a value is selected from an auto complete,then the corresponding check box with the same ID as the auto complete value,will be selected. The selection part is working perfectly,how ever I am trying to work out how to unchecked a selected check-box when the value of an auto-complete changes.I can detect the change but I am unsure how to unselected a check-box.</p> <p>Here is my code.</p> <pre><code> $(function () { var availableTags = ["ActionScript", "AppleScript", "Asp", "BASIC", "C", "C++", "Clojure", "COBOL", "ColdFusion", "Erlang", "Fortran", "Groovy", "Haskell", "Java", "JavaScript", "Lisp", "Perl", "PHP", "Python", "Ruby", "Scala", "Scheme", "eewjdskjuwwe"]; $("#tags").autocomplete({ source: availableTags, select: function (event, ui) { var txtbx1 = (ui.item.value); $("#tags").val(txtbx1); var tags = $("#tags").val(txtbx1); var checkboxval = ""; checkboxval = tags.val(); //alert($(tags).val()); $("#" + checkboxval + "").prop("checked", true); }, change: function (event, ui) { alert(checkboxval); } }); </code></pre> <p>I know it has something to do with this line of code but I'm a bit stuck.Where am I going wrong? Here is the link to my JS Fiddle : <a href="http://jsfiddle.net/lauriewilliams/45yQH/13/" rel="nofollow">http://jsfiddle.net/lauriewilliams/45yQH/13/</a></p> <pre><code> change: function (event, ui) { alert(checkboxval); } </code></pre> <p>EDIT: Here is the working solution. <a href="http://jsfiddle.net/lauriewilliams/45yQH/22/" rel="nofollow">http://jsfiddle.net/lauriewilliams/45yQH/22/</a></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.
    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