Jquery:
1.jQueryobject is throughJQueryPackagingDOMObject that is generated after the object。jquery objects are unique to jquery. If an object is a jquery object, it can use the method in jquery: $ ("#test"). html ();
For example:
$ ("#test"). html () means: Gets The HTML inside the element with ID test Code. where html () is the method in jQuery
This code is equivalent to using the DOM Implementation code:
document.getElementById ("test"). InnerHTML;
Although jquery objects are created after wrapping a DOM object, jquery cannot use any of the DOM object's methods, nor does the DOM object use the methods in jquery. Random use will errorConventions:If you are getting a JQuery object, precede the variable with $. ? var$variable = JQuery Object? varvariable = DOM Object
2. If you use jquery :In head: <script language= "JavaScript" src= ". /js/jquery-1.4.2.js "></SCRIPT>SRC The directory structure where the jquery framework is importedConvert a
3.dom object to a jquery object ... jquery into a DOM object ...
(1). Dom object converted to jquery object
<script language= "JavaScript" > //dom into jquery object $ (DOM object) var Obj=document.getelementbyid (" Username ");//alert (Obj.value) ; var $obj =$ (obj); Alert ($obj. Val ()); </script>
(2). jquery objects are converted to DOM objects ...
Method One: The jquery object is an array object that can be obtained by means of the [index] ObjectWay Two: jquery itself provides, through the. Get (Index) method, to get the corresponding DOM object
<script language= "JavaScript" > //jquery objects into DOM objects //(1) The JQuery object is an array object that can be obtained by means of [index] to the corresponding DOM object var $username =$ ("#username"); var username= $username [0]; alert (username.value); (2) jquery itself provides, through the. Get (Index) method, to get the corresponding Dom object var $username =$ ("#username"); var username= $username. Get (0); alert (username.value); </script>
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Black Horse DAY16 jquery Primer