I’ve built a little app that pastes some user generated text in to a textarea via a drop in div. This is done with the .click function and the .keypress function (using the Enter key).
Is there a way to get the .keypress function to fire only when the div is displayed?
Demo: http://jsfiddle.net/Mobius1/Sjyeh/2/
EDIT:
Now working!
Updated with Rory McCrossan’s input: http://jsfiddle.net/Mobius1/Sjyeh/8/
If I’ve understood your question, you can just check to see if the
.slideboxdiv is visible in thekeypress()handler:Updated fiddle