Retrieve Button value with jQuery

后端 未结 9 1764
一个人的身影
一个人的身影 2020-11-27 14:08

A simple one, I\'m trying to retrieve the value attribute of a button when its been pressed using jQuery, here\'s what I have:



        
9条回答
  •  悲&欢浪女
    2020-11-27 14:36

    As a button value is an attribute you need to use the .attr() method in jquery. This should do it

    
    

    You can also use attr to set attributes, more info in the docs.

    This only works in JQuery 1.6+. See postpostmodern's answer for older versions.

提交回复
热议问题