user2332467 user2332467 - 1 year ago 79
jQuery Question

keyup is not firing

I had this working but it has stopped. The weird thing is that 'mouseup' works but 'keyup' does not.

$(document).ready(function () {

$('#chordprodiv').on('keyup mouseup', 'textarea', function () {


Here is 2 fixes after the comments. I updated jquery and changed the function to .on, and I corrected the event format so they are in the same string. The code was already in the document.ready but I added that for clarity.

I have since targeted the parent div and identified the 'textarea' selector as per another suggestion.

Also here's the html

<textarea id="chordpro" name="chordpro"></textarea>

Dom Dom
Answer Source

.live is deprecated in newer versions of jQuery, you should be using .on

Additionally your events should be together in one string...

$('#chordpro').on('keyup mouseup', function () {

The event handler should be called in the format, as shown below. $( document ).on( events, selector, data, handler );

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download