Launching a jQuery Event from a Plugin on Checkbox Change -
i have following code:
<script> $('#switch-1:checkbox').change(function() { if (this.checked) { $('#generatepassword').pgenerator({'uppercase': true}); } else { $('#generatepassword').pgenerator({'uppercase': false}); } }; </script>
when checkbox checked or unchecked, want change parameters of plugin, goal generate password. in case i'm trying set parameter uppercase false or true depending if checkbox checked or not.
how write code sends parameters plugin upon event of checkbox click?
try this:
$('#switch-1').click(function() { if($(this).prop('checked') == true) { $('#generatepassword').pgenerator({'uppercase': true}); } else { $('#generatepassword').pgenerator({'uppercase': false}); } };
Comments
Post a Comment