I am new to jQuery. I want to write the following HTML (along with the classes) using jQuery. How can I do this?
<div class="phnbr">
<div class="phtext">hi how are you, <a target="_blank" href="http://www.xyz.com">click here.</a>
</div>
</div>
$('<div>').addClass('phnbr').append($('<div>').addClass('phtext').append('hi how are you, ').append($('<a>').attr({ target: '_blank', href: 'http://www.xyc.com'}).text('click here.')));
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