jQueryのチェックボックスのボタンがいくつかあり、正常に動作します。ただし、クリックしてテキストを変更したいと思います。たとえば、ボタンのテキストは「クリックしてください」です。ユーザーがクリックすると、たとえば、「クリックしていただきありがとうございました」に変更する必要があります。jQuery変更チェックボックスのボタンのテキスト
<script>
$(function() {
$("#button").button();
$("#button").click(function(){
if($("#label").is(':checked')) {
$("#label span").text("Hide");
}
else {
$("#label span").text("Show");
}
});
});
</script>
<input id='button' type='checkbox' />
<label id='label' for="button">Show/Hide</label>