ask for advice, thank you
ask for advice, thank you
JQuery itself is the encapsulation of JS, and you can get the answer by looking up the source code of JQuery. If you want to write your own traversal JS, you can first refer to the source code of JQuery and the traversal code of other languages, which should be helpful to encapsulate the native JS.
for more information on the source code, please refer to the following blog content written by nuysoft:
http://www.cnblogs.com/nuysof.
JQuery is mainly implemented through two basic attributes of HTML DOM, nodetype and nextsibling. Some of these functions also involve attributes such as parentNode,children.
some common native JS is also written around these basic HTML properties and JS syntax.
HTML DOM nodetype attribute
nodeType property returns the node type of the specified node as a numeric value.
if the node is an element node, the nodeType attribute returns 1.
.
if the node is document, the nodeType property returns 9.
HTML DOM nextSibling attribute
nextSibling attribute: this attribute represents the next node of the current node; if there is no node of the same level thereafter, it returns null;
JQuery traversal iterates through three core functions
jQuery.dir (elem, dir, until), starting from one element, iteratively retrieves all elements in a certain direction and records until the element jQuery.nth (cur, result, dir, elem) that matches the document object or until starts from one element, iteratively retrieves all subsequent sibling elements of the nth element jQuery.sibling (n, elem) element n in a certain direction, including n, excluding elem
original code: $bars[i].style.top =160 - height + sinTable[(ang + (i * freq)) & 4095] * height + px ; $bars[i].style.height = height2 + px ; but it seems that .style is rare, so I m going to use .css instead: var style={ top:160 - heig...
the effect you need to achieve is to click on a link and add class= "on " to .bofangqi dd div. The code written by is as follows: $(".bofangqi dd").on("click",function(){ $(this).find("div").addClass( on ).si...
the details are as follows Zhang San s score is 98, Li Si s score is 65, Wang Wu s score is 75 how to sort by score and show his score and name. Could you tell me how to sort from high to low with JS? Thank you very much. ...
as shown in the picture, jquery.form.js has been imported, and then jquery in order, but still reported an error. Ask God for advice ...
in learning sharp jquery, I encountered a problem when I introduced the old version of jquery (version 1.71 in the book) and the latest version of jquery when the structure and content of html were the same. has a total of four check boxes, which work...
the logic for the background to return the json result is Map<String, Object> resultMap = new HashMap<>(); resultMap.put("userType", userType); resultMap.put("phone", phone); resultMap.put("channel&q...
for example, 4.1-8.2 is 4 months and 2 days ...
this is what I m using now var rectangle = new google.maps.Rectangle( { strokeColor : -sharpFF0000 , strokeOpacity : 0.8, strokeWeight : 0, fillColor : -sharp575757 , ...
when looking up the map method in jq, the W3C document has this code $("p").append( $("input").map(function(){ return $(this).val(); }).get().join(", ") ); after searching get (), there is no relevant explanation. What ...
panzoom is very good, with a full range of properties and events, but it s a bit stuck to use. Is there a js or JQ plug-in that is easier to use than panzoom? needs to pan and zoom more smoothly. ...
$(".questionClass>input[type= text ]").val(imgList.join(",")) now that there are four questionClass classes, I need to pinpoint the input, under a certain questionClass in this selector. ...
Why is the js of the same segment normal on PC but not on mobile? html call code: <div id="pgbtn" class="pgbtn_page"> <a class="page_a" href="javascript:;" rel="forum.php?order={$_GET[ orde...
want to find an example of a list click on a list of Tibetan dishes that can click on the right button to appear to the left and then go back to the right when you take it back I don t know what keywords to use to check what is the name of this tec...
I encapsulated a js function myself! There are some problems with using . I set callback, to increase as the number of clicks increases, so does the number of execution. I don t know why! functions encapsulated by js showConfirm(title , content , sh...
textarea how to let users wrap the code before carriage enter with a P element each time they press enter or how to achieve segment spacing (not line spacing) ask for advice ...
hotspotinformation hotspotsmessage the current requirement is that 16 pieces of data are randomly obtained from hotspotmessage, and then it is shown that the calculation attribute hotspots has implemented this requirement. now I want to click on t...
this situation is a bit complicated. the front end shows: first of all, I have a list that will have the member s name plus checkbox (follow) on a date I will display the name of the member with the last day PS:. My form does not have a subscriptio...
error prompt: Uncaught TypeError: autopbn.getAttribute is not a function at exauto_ajax_page.js?s1m:10 var autopbn = $( autopbn ); var nextpageurl = autopbn.getAttribute( rel ).valueOf(); Uncaught TypeError: autopbn.getAttribute is not a function...
want to check how many png files there are. I want him to run in sequence, so it will be very much like the gif action. how can this be done? ...
div divcss when dragging to the middle left, there is also a dotted frame on the left, and when you let go, the dragged div is docked on the left. if you drag to the middle right, the dragged div will dock to the right when you let go. [if my ...