javascript - use an href to click a checkbox to fire an event -


i have code looks this:

$('#clearselections').click(function(e) {     $("#isacheckbox").removeattr("checked");     redrawtableoflistings(); });        <a href="#" id="clearselections">clear selections</a>  <input type="checkbox" id="isacheckbox" checked>  // when user clicks on checkbox, dosomething happens. 

basically, when user clicks on href, want use jquery make href handle checkbox same way though user put check in checkbox.

does make sense? when use "removeattr" removes checkbox, , doesen't redraw form.

thanks in advance! , safe fireworks weekend!

it seems want deselect checkbox when link clicked (at least infer text clear selections). it:

$('#clearselections').click(function(e) {     e.preventdefault(); // don't follow link     $("#isacheckbox").prop("checked", false);     redrawtableoflistings(); }); 

demo


Comments

Popular posts from this blog

sql - text truncated using perl DBI insert -

c++ - Is it possible to compile a VST on linux? -

php - Pass object by reference or value -