Link to home
Start Free TrialLog in
Avatar of mhdi
mhdi

asked on

Javascript replace text string with h3

Hi,

Using Chrome Dev Tools I have found the CSS selector of a H3 heading.

#container > div.my-table > h3

Open in new window


Within the H3 heading is "Test - some more text here". I need to replace "Test" with "New".

The following attempt results in an 'undefined' error message -

document.body.innerHTML = document.querySelector('#container>div.my-table>h3').replace("Test", "New");

Open in new window


Can anyone see what I am doing wrong?
ASKER CERTIFIED SOLUTION
Avatar of sudheeshthegreat
sudheeshthegreat

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial