我有一些jQuery代码可以在单击按钮时更改按钮文本。最初(单击之前)按钮是这样的:
<button type="button"style="margin-top: 5px;" class="btn btn-danger btn-sm" id="image-remove-btn-4">
<i class="fa fa-trash"></i>
Remove Photo
</button>
这是我的jQuery将按钮名称更改为 Photo deleting...
$("#image-remove-btn-4").text("Photo deleting...");
按钮文本已成功更改,但是问题在于,一旦单击按钮,FontAwesome图标将被删除。有什么解决方案吗?
尝试一下:
$("#image-remove-btn-4").html("<i class='fa fa-trash'></i> Photo deleting...");
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句