Get the App
SLTechnology News&Howtos  ›  Development  › 

How jquery changes the value of button

Shulou Source: shulou.com Published: 2022-05-31 18:44:54 09月22日 Update

This article mainly explains "how jquery changes the value of button". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how jquery changes the value of button".

Jquery changes the jquery value of the method: 1, use html () to the specified element to set new content, syntax "$(" button "). Html (" new content value ")"; 2, use text () to set new text content for the specified element, syntax "$(" button "). Text (" new value ")".

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

Jquery changes the value of button

Implementation method:

Use $("button") to get the button element

Use html () or text () to modify the value of the selected element

1. Use html ()

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

$(document) .ready (function () {$("button") .click (function () {$(this) .html ("button New value");}) Modify button content

2. Use text ()

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

$(document) .ready (function () {$("button") .click (function () {$(this) .text ("Hello world!");}) Modify button content

Thank you for your reading, the above is the content of "how jquery changes the value of button". After the study of this article, I believe you have a deeper understanding of how jquery changes the value of button, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Tags: Content elements methods learning text new content grammar that is ideas situations tutorials articles more versions environment computers knowledge knowledge points articles systems Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MariaDB vpn Huawei Xiaomi Shulou Information