I have a div tag:
<div id="content"><p></p><a href="#"></a></div>
I want to insert dynamically different content into the <p> tag and also into the href attribute of the <a> tag.
I am using jQuery.
I have a div tag:
<div id="content"><p></p><a href="#"></a></div>
I want to insert dynamically different content into the <p> tag and also into the href attribute of the <a> tag.
I am using jQuery.
As easy as:
$("#content > p").html("Some content");
$("#content > a").prop("href", "/new/link.html");
Or in chain:
$("#content")
.find("p").html("Some content")
.end()
.find("a").prop("href", "/new/link.html");
$("#content a.blue").prop(...);.class="blue red" means that element has both CSS classes blue and red.