Question

I have a lightbox that opens with prettyphoto using inline html. In the lightbox, there's an image, a textbox, and some links. The code is:

<img src="someimg.png" />
<textarea class="myclass"></textarea>
<a href="#">My Link</a>

On change of the text in the textbox, I want that text appended to the link. For some reason, the change event does not fire. I have mimicked the code on the page the main page and it works, but no dice on the prettyphoto overlay.

Here is that code:

$('textarea').change(function () {
var words = $('textarea').val();
 }); //end onchange for text box

I have tried combinations of .bind('change'), .bind('keyup'), etc. Any help would be greatly appreciated. Thanks!

Was it helpful?

Solution

If you are trying to manually trigger the change event of the textbox, I am assuming in the open event of the overlay is where you want to do it. Your code binds the event, but you need to trigger it manually in addition to binding it:

$('textarea').trigger('change');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top