Reputation: 402
I'm trying to append a <p>
tag to a div
element. The problem is that I need to hide the div element but not the appended <p>
tag. Somehow prepend it before or after. What can I do?
<div id='vid1'></div>
$('#vid1').append('<p class="ytclick">text</p>');
$('#vid1').hide();
Upvotes: 0
Views: 34
Reputation: 382474
You can't have a visible element in a hidden one.
You should probably use before
or after
:
$('#vid1').after('<p class="ytclick">text</p>');
Upvotes: 2