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
.
$('button.myBtn.myBtnCTA.signIn span').text()
$(".myBtn.myBtnCTA.signIn span").text("Hello world!");
请注意,此选择器可能效率低下。
试试这段代码
$(".myBtn.myBtnCTA.signIn span").text("text");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.