Want more features on Pastebin? Sign Up, it's FREE!

WordPress TinyMCE jQuery .keyup() ????

By: keha76 on Aug 27th, 2012  |  syntax: JavaScript  |  size: 0.73 KB  |  views: 225  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. // How can I get the .keyup() to work with the TinyMCE editor in WordPress????
  2. // Changing #title to #content does NOT work ( the #title DOES work ( not a TinyMCE either ))
  3. // How do I fix it?
  4.  
  5. jQuery('#title').keyup(function() {
  6.  
  7.         // Variables fetched from dynamically created link
  8.         post_id = jQuery('.thehreflink').attr("data-post_id"); // Post ID
  9.         nonce = jQuery('.thehreflink').attr("data-nonce"); // Nonce
  10.         content = $(this).val(); // Element content
  11.  
  12.         // The ajax request...
  13.         jQuery.ajax({
  14.                 type: "POST",
  15.                 url: 'admin-ajax.php',
  16.                 data: {
  17.                         action: 'myfunction',
  18.                         content: content,
  19.                         post_id: post_id,
  20.                         nonce: nonce
  21.                 },
  22.                 success: function(response) {
  23.                         jQuery('div#output').html(response);
  24.                 }
  25.         });
  26. })
clone this paste RAW Paste Data