JQuery get the title of a button

前端 未结 8 1187
遇见更好的自我
遇见更好的自我 2020-12-30 18:33

I have a button:


Which makes this:

8条回答
  •  庸人自扰
    2020-12-30 19:10

    add id to your button like this

    
    

    now you can use JS like this

    var button_text = document.getElementById('your_button_id').innerHTML;
    

    and also you can use JQUERY like this

    var button_text = $('#your_button_id').text();
    

提交回复
热议问题