Reputation: 255
I have appended an textarea to the element using:
$('#first').after('<textarea name="textarea" id="textarea" cols="45" rows="5"></textarea><button></button>');
I would like to call a wysiwyg()
function on that text area:
$('#textarea').wysiwyg();
This does not work because the element is appended after.
Any advice how to get an element that is appended with the id #textarea in order to call that function on it?
Upvotes: 0
Views: 47
Reputation: 37866
try this:
$(parent_element_of_textarea).on('noevent', '#textarea' ,function(){
$(this).wysiwyg();
});
$('<textarea name="textarea" id="textarea" cols="45" rows="5"></textarea><button></button>').insertBefore('#first');
Upvotes: 1