How do I change/replace the <h3>
text: "Featured Offers" using javascript to say "Public Offers" instead?
</div> <!-- FEATURED OFFERS --> <div class="panel"> <div class="head"> <h3>Featured Offers</h3> </div> <div class="body"> <table> <thead> <tr>
Use the textContent property to change the text of a heading element, e.g. heading. textContent = 'Replacement heading text' . The textContent property will set the text of the heading to the provided string, replacing any of the existing content.
text() Replace text Replaces the text in the selected elements. Example: text("clicked") - Click on the heading text to change it. $(document). ready(function() { $("h1").
Answer: Use the jQuery text() method You can simply use the jQuery text() method to get all the text content inside an element. The text() method also return the text content of child elements.
If you can select it, you can manipulate it.
Try this:
$(".head h3").html("your new header");
But as others mentioned, you probably want head
div to have an id.
you don't - not like this. give an id to your tag , lets say it looks like this now :
<h3 id="myHeader"></h3>
then set the value like that :
myHeader.innerText = "public offers";
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