I have a button right this:
<button type="submit" class="btn blue pull-right" id="RequestNewPwd">
Submit <i class="m-icon-swapright m-icon-white"></i>
</button>
With a text and an icon. I'm trying to change the text and the icon like via javascript like this:
$("#RequestNewPwd").button({
label: "Sent",
icons: {
primary: "m-icon-swapleft m-icon-white",
}
})
But it does not work. I also tried:
$("#RequestNewPwd").text('Submit <i class="m-icon-swapright m-icon-white"></i>');
And it prints the html code like text. This works:
$("#RequestNewPwd").text('Submit');
But I need to show also the icon. Could someone help me? Thank you!
You have to use .html()
to render the string into html elements.
Try,
$("#RequestNewPwd").html('Submit <i class="m-icon-swapright m-icon-white"></i>');
在添加html时,需要使用.html()
而不是.text()
:
$("#RequestNewPwd").html('Submit <i class="m-icon-swapright m-icon-white"></i>');
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.