I would like to append an anchor text in an a tag using jquery. Normally I can make an a tag look like this
<a href="#" >Hey</a>
and Hey is the anchor text. But what I want to do is just have
<a href="#"></a>
and then use a javascript file running in the background append Hey as an anchor text to that link. How can I get that done?
EDIT This is what I tried to do but it didn't work.
$('hey').appendTo('.chat');
Where chat was the class name of the a tag.
$('<p>Hey</p>').appendTo('.chat');
That didn't work as well.
But thanks anyway guys. This code works
$('.chat').html('Hey');
Seeing that you tagged jQuery in the question:
$('a').html('Hey');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With