How Do I Replace/Change The Heading Text Inside

, Using jquery?

How Do I Replace/Change The Heading Text Inside

, Using jquery?

How do I change/replace the

text: “Featured Offers” using javascript to say “Public Offers” instead?

Featured Offers

Solutions/Answers:

Solution 1:

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.

Solution 2:

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";

Solution 3:

$("h3").text("context")

Just use method “text()”.

The .text() method cannot be used on form inputs or scripts. To set or
get the text value of input or textarea elements, use the .val()
method. To get the value of a script element, use the .html() method.

http://api.jquery.com/text/

Solution 4:

Something like:

$(".head h3").html("Public offers");

Solution 5:

try this,

$(".head h3").html("New header");

or

$(".head h3").text("New header");

remember class selectors returns all the matching elements.

Solution 6:

Give an id to h3 like this:

<h3 id="headertag">Featured Offers</h3>

and in the javascript function do this :

document.getElementById("headertag").innerHTML = "Public Offers";

References

Related:  While debugging javascript, is there a way to alert current call stack?