Front-end HTML and tags

Source: Internet
Author: User

1. The full HTML page label must have

< HTML >    < Head >        <  charset= "">   //General need to specify the encoding language   </Head  >        <body></body> </ HTML >

2. html page embedding JS code in two ways

Method one:<type= "Text/javascript"></script  >
Method Two: <script type= "Text/javascript" src= "" ></scripts>

3. HTML pages embed CSS code in two ways

method One:< style type= "Text/css" ></ style >
Method Two: <link rel= "stylesheet" href= "CSS location" type= "Text/css" >

One of the rel= "stylesheet" in the link tag defines an external style sheet

4. JQuery

4.1 The following function cannot be omitted, it is $ (document). The abbreviation for Ready (function () {}), which means that the code inside the function can be executed after the HTML page is loaded

$ (function() {

})

4.2 For labels that are not button,div input type, you need to use text () to get the contents between tags, or you can set the Value property for the button and get the value values using the Val () function. Like what

<val= "button"></button>

$ ("button"). Click (function () {
  
$ ("button"). val ()); Eject button
Alert ($ ("button"). text ());//Eject I know  
})

4.3 using jquery to get the right to use tags

There are three main categories: the original HTML element selector, with the class selector and the ID selector in the tag, such as:

<val= "button"></button>
$ ("button"). Click (function() {//This is the HTML original label})  $ ("#ha"). Click (function() {  ID Selector}) $ (". Hi"). Click (function() {//class selector})

Front-end HTML and tags

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.