Home >Web Front-end >JS Tutorial >SET and GET_jquery commonly used in jquery

SET and GET_jquery commonly used in jquery

WBOY
WBOYOriginal
2016-05-16 18:56:351224browse

$("#msg").html(); //Return the html content of the element node with id msg.
$("#msg").html("new content");
//Write "new content" as an html string into the content of the element node with the id of msg, and the page will display bold new content

$(”#msg”).text(); //Return the text content of the element node with id msg.
$("#msg").text("new content");
//Write "new content" as a normal text string into the content of the element node with the id of msg, and the page will display new content

$(”#msg”).height(); //Return the height of the element with id msg
$(”#msg”).height(”300″); //Return the id to msg Set the height of the element to 300
$("#msg").width(); //Return the width of the element with id msg
$("#msg").width("300"); //Set the width of the element with id msg to 300

$("input").val("); //Return the value of the form input box
$("input"). val("test"); //Set the value of the form input box to test

$("#msg").click(); //Trigger the click event of the element with id msg
$(”#msg”).click(fn); //Add a function for the click event of the element with id msg

Similarly, blur, focus, select, and submit events can have these two calls method

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