Get the App
SLTechnology News&Howtos  ›  Development  › 

How jquery modifies the value of button

Shulou Source: shulou.com Published: 2022-06-01 04:53:02 11月29日 Update

Most people do not understand the knowledge points of this article "jquery how to modify the value of button", so the editor summarizes the following, detailed content, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "jquery how to modify the value of button" article.

Jquery to modify the value of the method: 1, use html () function, syntax "$(" button "). Html (" new value to be set ");"; 2, use text () function, syntax "$(" button "). Text (" new value to be set ");".

The operating environment of this tutorial: windows7 system, jquery1.10.2 version, Dell G3 computer.

Jquery modifies the value of button

Method 1: use the html () method

The html () method sets or returns the content (innerHTML) of the selected element.

$(document) .ready (function () {$("button") .click (function () {$("button"). Html ("modified, new value");}) Modify the value of the button

Method 2: use the text () method

The text () method sets or returns the text content of the selected element.

When this method is used to return content, it returns the text content of all matching elements (the HTML tag is removed).

When this method is used to set content, the contents of all matching elements are overridden.

$(document) .ready (function () {$("button") .click (function () {$("button"). Text ("set the new value");}) Modify the value of the button

The above is about the content of this article on "how jquery modifies the value of button". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please follow the industry information channel.

Tags: Content methods elements functions buttons text articles knowledge articles grammar values most of them that is tutorials more tags steps versions environments computers Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information NVidia Shulou Tech Info Shulou Technology MySQL