samedi 5 novembre 2016

Launching a jQuery Event from a Plugin on Checkbox Change

I have the following code:

      <script>
        $('#switch-1:checkbox').change(function() {
if (this.checked) {
      $('#generatepassword').pGenerator({'uppercase': true});
} else {
      $('#generatepassword').pGenerator({'uppercase': false});
}
};
      </script> 

When my checkbox is checked or unchecked, I want it to change the parameters of a plugin, whose goal is to generate a password. In this case I'm trying to set the parameter to uppercase FALSE or true depending if the checkbox is checked or not.

How do I write the code so that it sends the parameters to the plugin upon the event of the checkbox click?




Aucun commentaire:

Enregistrer un commentaire