Home  >  Article  >  Web Front-end  >  How to modify the value of button in jquery

How to modify the value of button in jquery

青灯夜游
青灯夜游Original
2022-03-18 13:58:185964browse

Jquery method to modify button value: 1. Use html() function, syntax "$("button").html("New value to be set");"; 2. Use text() function , the syntax is "$("button").text("New value to be set");".

How to modify the value of button in jquery

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

jquery changes the value of the button

Method 1: Use the html() method

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




	
		
		
		
	

How to modify the value of button in jquery

Method 2: Use text() method

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

When this method is used to return content, the text content of all matching elements is returned (HTML tags will be removed).

When this method is used to set content, the content of all matching elements is rewritten.




	
		
		
		
	

How to modify the value of button in jquery

[Recommended learning: jQuery video tutorial, web front-end

The above is the detailed content of How to modify the value of button in jquery. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn