samedi 28 février 2015

Changing on keyup to click event not triggering action

I am trying to add a click event on a function, but for some reason nothing is happening, no errors in the console and action is not triggered. This is the plugin that I am altering: http://ift.tt/1G2m5V3 and on line 102 - 106



window.onload = function() {
tinymce.get('bbp_<?php echo $type; ?>_content').on('keyup', function(e) {
bbp_preview_post(this.getContent(), '<?php echo $type; ?>', true);
});
}


this is the function that is triggering the event on keyup


I tried


HTML



<button type="button" id="bbp_topic_preview" class="button submit">Preview Topic</button>


Jquery - V1



window.onload = function() {
tinymce.get('bbp_<?php echo $type; ?>_content').on('click', '#bbp_topic_preview', function(e) {
bbp_preview_post(this.getContent(), '<?php echo $type; ?>', true);
});
}


Jquery - V2



window.onload = function () {
jQuery('#bbp_topic_preview').on('click', function() {
tinymce.get('bbp_<?php echo $type; ?>_content').on('ready', function(e){
bbp_preview_post( this.getContent(), '<?php echo $type; ?>', true );
});
});
}


But nothing is happening and no errors echoed in the console.


Aucun commentaire:

Enregistrer un commentaire