jQuery 动态更改按钮上的图标或文字

参考链接:http://stackoverflow.com/questions/5580616/jquery-change-button-text

<input type='button' value='Add' id='btnAddProfile'>
<script>
$("#btnAddProfile").attr('value', 'Save'); //versions older than 1.6
</script>

<input type='button' value='Add' id='btnAddProfile'>
<script>
$("#btnAddProfile").prop('value', 'Save'); //versions newer than 1.6
</script>

<!-- Different button types-->

<button id='btnAddProfile' type='button'>Add</button>
<script>
$("#btnAddProfile").html('Save'); // 支持修改图标
$("#btnAddProfile").text('Save'); // 只支持修改文本
</script>

 

posted @ 2017-03-07 17:40  RickyShilx  阅读(41443)  评论(0编辑  收藏  举报