Home > Web Front-end > JS Tutorial > body text

Introduction to SET and GET$('#msg').html loops commonly used in jquery_jquery

WBOY
Release: 2016-05-16 17:20:38
Original
1356 people have browsed it
Copy code The code is as follows:

$("#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

$.each( [0,1,2], function(i, n){ alert( "Item #" i ":" n );});
[code]
is equivalent to:
[code]
vartempArr=[0,1,2] ;
for(vari=0;ialert("Item#" i ":" tempArr[i]);
}
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template