javascript - Select and trigger click event of a radio button in jquery -


upon document load, trying trigger click event of first radio button.... click event not triggered.also, tried 'change' instead of click ...but same result.

$(document).ready(function() {     //$("#checkbox_div input:radio").click(function() {      $("input:radio:first").prop("checked", true).trigger("click");      //});        $("#checkbox_div input:radio").click(function() {        alert("clicked");      });  }); 

please follow below link question

example: http://jsbin.com/ezesaw/1/edit

please me out in getting right. thanks!

you triggering event before event bound.

just move triggering of event after attaching event.

$(document).ready(function() {   $("#checkbox_div input:radio").click(function() {      alert("clicked");     });    $("input:radio:first").prop("checked", true).trigger("click");  }); 

check fiddle


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -