JQuery get the title of a button

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

I have a button:


Which makes this:

8条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-30 19:06

    Try this event.target

    $("button").click(function(event){
    var text=$(event.target).attr("value")
    alert(text);
    });
    

提交回复
热议问题