Tag:jquery

  • Boredom

    Time:2019-8-23

    Don’t say much, just go to the code. <html> <head> < title > countdown </title > </head> <body> <div id=”time1″></div> <p>———————–</p> <div id=”time2″></div> </body> <script></script> <script type=”text/javascript”> window.onload = function () { endTime(); } function endTime() { var myDate = new Date(); var timestamp = Date.parse(myDate) / 1000; var date = myDate.getDate(); var year = […]

  • How Ajax handles three data formats returned by server

    Time:2019-8-23

    This article itself is very basic, but often in dealing with the return value of Ajax will make a variety of minor mistakes, so I want to combine these methods with the code snippets written before to sort out, facilitate future review and use. In addition, although many similar documents can be found, but sorting […]

  • Offset () for jQuery source parsing

    Time:2019-8-22

    Offset () Effect:Returns the selected element relative toDocumentMigration coordinates Two or three cases are used: 1、$().offset() <body> <script></script> <p id=”p Two”>This is div Two</p> <script> $(“#pTwo”).offset() //{top: 16, left: 8} </script> </body> Source code: // Returns the offset coordinates of the target element relative to doucument. // That is, the distance from the upper left […]

  • [Method] Html5 realizes file asynchronous upload

    Time:2019-8-22

    1 Introduction Developing file upload function is never a pleasant thing, especially asynchronous upload. It also feels awkward to use iframe and Flash upload schemes. This paper briefly introduces the use of Html5 FormData to achieve asynchronous upload of files, but also to achieve upload progress bar and file size verification. The server uses the […]

  • Front-end knowledge 10 points (2019.5.2)

    Time:2019-8-21

    1. Why is jQuery a self-calling anonymous function as a whole? Because everything in the self-execution of anonymous functions islocalThis way, jQuery can be referenced to prevent conflicts with other code. 2. The difference between jQuery static method and instance method $()Is a jQuery object returned by calling the jQuery method.$()The method of invocation isExample […]

  • Spring MVC Ajax method of transferring objects to controllers

    Time:2019-8-21

    Preface Recently, I am writing a project based on spring MVC + Spring + mybatis, which involves the function of sending data to controller with ajax. Because you don’t want to use Spring’s form tag, you want to see if there is a way to convert JSON data in Ajax directly into objects in the […]

  • Position () of jQuery source parsing

    Time:2019-8-20

    position()Effect:Returns the selected element relative toParent elementMigration coordinates Use:Direct call$().position()This method has no arguments. <body> <script></script> <p id=”p Two”>This is div Two</p> <script> $(“#pTwo”).position() //{top: 0, left: 8} </script> </body> Source code: // Returns the offset coordinates of the selected element relative to its parent // It can be understood that the selected element is […]

  • JQuery Event Delegation Code Practice

    Time:2019-8-20

    The event model of JavaScript adopts the “bubbling” mode, and the events of child elements will “bubbling” upward step by step and become the events of parent elements. Event delegation should be used when you need to bind events for more elements JavaScript event propagation Html is as follows: <body> <table> <tr><td></td><td></td><td></td></tr> <tr><td></td><td></td><td></td></tr> </table> </body> […]

  • JQuery selector

    Time:2019-8-19

    Link: jQuery selector Basic selector *Select all elements .classChoiceclassFor example:$(‘.mybox’) elementChoiceelementFor example:$(‘p’) #idChoiceidFor example:$(‘#box’) selector1,selectorNMultiple elements can be selected at the same time, such as:$(‘div, p.box, #phone’) Hierarchy Hierarchy parent > childSelect the specified child element under the specified element, such as:$(‘ul.tonav > li’) ancestor descendantSelect all descendant elements in an element, such as:$(‘form input’) […]

  • Flask+JQuery Validation Plug-in+Ajax for form validation

    Time:2019-8-19

    Form submission and validation are often involved in Flask web development practice. Flask plug-in flask-wtf provides many methods of form validation. However, it is known that these forms validation need to be submitted before validation. It is not possible to check the format of user name when the user enters the user name correctly. Recently, […]

  • How to Avoid the Event Overlapping Problem of jQuery Dynamic Binding

    Time:2019-8-19

    I’m currently working on a form page.1. Bootstrap for pagination. By dynamically giving each binding event, click and jump to the specified data to show that it is normal.2. When we do the previous page and the latter page dynamically bind events, event overlap occurs, resulting in an exception.3. Solution, to the previous page, the […]

  • Time stamp and date conversion based on jQuery

    Time:2019-8-19

    In this paper, we share the jQuery timestamp and date conversion code for your reference. The details are as follows. Background: Requirements are shown as follows: Direct to the code, all the content is in the comments: /** * Formatting time: Plus 0 operation * */ function supplement(num){ if(parseInt(num) < 10){ num = ‘0’+num; } […]