I have html structure like this,
<button class="myBtn myBtnCTA signIn" onclick="javascript:;">
<span>Close</span>
</button>
I want to change the text from "Close" to "Save & Close". I tried this $(button .myBtn myBtnCTA signIn span).text() but this doesnt seem to work. Any suggestion??
Use . dot to join multiple classes, also give selector in quotes.
Live Demo
$('button.myBtn.myBtnCTA.signIn span').text()
$(".myBtn.myBtnCTA.signIn span").text("Hello world!");
Beware that this selector may be inefficient.
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