Compare AppendChild () in JavaScript with append () in jquery to know what Jqery is.

Source: Internet
Author: User

1<!doctype html>234<!--statement current page encoding set (Chinese code "gbk,gb2312", International Code "UTF-8")--5<meta http-equiv= "Content-type" content= "text/html"; charset= "Utf-8" >6     7<title>html Templates </title>8<meta name= "keywords" content= "keywords, key words" >9<meta name= "description" content= "" >Ten<style type= "Text/css" > One*{margin:10 auto;padding:0} A</style> -<script type= "Text/javascript" src= "Jquery-1.11.3.min.js" ></script> -<script type= "Text/javascript" > the             varci1=[' Province 1 ', ' Province 2 ', ' Province 3 ', ' Province 4 ']; -Window.onload=function(){ - createCity1 (); -             } +             functioncreateCity1 () { -                 varCity1=document.getelementbyid (' City1 '); +                 //Create label, create label must be parameter must be label name A                 varOp=document.createelement ("option"); atOp.innerhtml= "Please select Province" - city1.appendchild (OP); -         //city1.appendchild ("<option> Please select Province </option>"); it's wrong to write. -  -                  for(vari=0;i<ci1.length;i++){ -         //for (var i in CIL) {//With this may appear browser incompatible in                        varOp_in=document.createelement ("option"); -Op_in.innerhtml=Ci1[i]; to city1.appendchild (op_in) +                 } -             } the$(function(){ *                 //This shows the power of jquery, the Append method is to add content directly behind the object, and then make the Yi. This is a cow. $$ ("#city2"). Append ("<option> Please select Province </option>");Panax Notoginseng               for(vari=0;i<ci1.length;i++){ -$ ("#city2"). Append ("<option>" +ci1[i]+ "</option>"); the                  } +             }) A         //createCity1 (); the</script> + -<body> $<select id= "City1" ></select> $<select id= "City2" ></select> -   -   the</body> - Wuyi

Compare AppendChild () in JavaScript with append () in jquery to know what Jqery is.

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.