jquery size and jquery settings and get content methods

Source: Internet
Author: User

First, the size of jquery

JQuery offers several important ways to handle dimensions:

Width () Sets or returns the length of the element (excluding padding, borders, or margins), the value width parameter is filled in parentheses, no units

Height () Sets or returns the altitude of the element (excluding padding, borders, or margins), which can be filled in parentheses with a numeric height parameter, without units

Innerwidth () returns the width of the element (including the padding)

Innerheight () Returns the height of the element (including the padding)

Outerwidth () returns the width of the element (including padding and borders)

Outerheight () Returns the height of the element (including padding and borders)

Outerwidth (True) returns the width of the element (including padding, borders, and margins)

Outerheight (True) returns the height of the element (including padding, borders, and margins)

you can also get width of HTML document and browser window:

$ (window). Width ()// Gets the widths of the current browser window

$ (window). Height ()// Gets the altitude of the current browser window

$ (document). Width ()// gets the width of the HTML document (body)

$ (document). Height ()// gets the altitude of the HTML document (body)

Ii. how jquery is set up and acquired

text ()- Sets or returns the text content of the selected element

HTML ()- Sets or returns the contents of the selected element (including HTML tags)

Val ()- Sets or returns The value of form value

<!DOCTYPE HTML><HTMLLang= "en"><Head>    <MetaCharSet= "UTF-8">    <Metaname= "Viewport"content= "Width=device-width, initial-scale=1.0">    <Metahttp-equiv= "X-ua-compatible"content= "Ie=edge">    <title>Document</title></Head><Body>    <inputtype= "text"value= "Please enter content"/>    <Div><ahref="##">Dot me!</a></Div></Body></HTML><Scriptsrc= "Js/jquery-1.12.4.min.js"></Script><Scripttype= "Text/javascript">    $('input'). Val ('the content has been modified'); //set the value of the form's Values propertyConsole.log ($ ('input'). Val ()); //get the value of a form's property    $('Div'). HTML ('<a href= "# #" > Click on me!!!! </a>'); //set the contents of a div tagConsole.log ($ ('Div'). HTML ()); //get the contents of a div tag    $('Div'). Text ('<a href= "# #" > Click on me!!!! </a>'); //set the text content of a div tagConsole.log ($ ('Div'). text ()); //get the text content of a div tag</Script> 
Second, JQuery set up and get content methods

jquery size and jquery settings and get content methods

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.