<!DOCTYPE HTML><HTML><HeadLang= "en"> <MetaCharSet= "UTF-8"> <title>Test</title> <Scripttype= "Text/javascript"src= "Js/jquery-1.12.4.js"></Script> <Scripttype= "Text/javascript"> $(function(){ //using Innerhtml,innertext,value in DOM to get content varDom=document.getElementById ("Box"); //alert (DOM); Show [Object Htmldivelement] varresult=dom.innerhtml; //alert (result);//Display <p> today is July 1, 2017,<span> 20 anniversary of Hong Kong's reunification! </span></p> varRESULT1=Dom.innertext; alert (RESULT1); //Show today is July 1, 2017, the 20 anniversary of Hong Kong's reunification! //var result2 = Dom.value; This is not the case here because only the form element has value //table cell is known as: ①input ②select-option③ multi-line text field <textarea> //jquery uses text (), HTML (), Val () to get the content, varRESULT3=$("Div"). text (); //alert (RESULT3); Show today is July 1, 2017, the 20 anniversary of Hong Kong's reunification! varRESULT4=$("Div"). html (); //alert (RESULT4)//Display <p> today is July 1, 2017,<span> the 20 anniversary of Hong Kong's reunification! </span></p> //the transformation of Dom and jquery //Dom transforms into jquery varRESULT5=$ (DOM). text (); //jquery converted to Dom varJQ=$("Div"); varresult=jq[0].innerhtml; //or var result = Jq.get (0). InnerHTML; }); </Script></Head><Body><DivID= "box"> <P>Today is July 1, 2017,<span>The 20 anniversary of Hong Kong's reunification!</span></P></Div></Body></HTML>
First knowledge of jquery