What is jQuery?


  • JQuery is a fast and concise javascript library created by John Resig in 2006. It is currently maintained by a team of developers led by Timmy Willison (with the jQuery selector engine, Sizzle, being led by Richard Gibson).
  • jQuery is a lightweight, "write less, do more", JavaScript library.
  • The purpose of jQuery is to make it much easier to use JavaScript on your website.
  • jQuery takes a lot of common tasks that require many lines of JavaScript code to accomplish and wraps them into methods that you can call with a single line of code.
  • jQuery also simplifies a lot of the complicated things from JavaScript, like AJAX calls and DOM manipulation.
  • It has thousand of inbuilt animations, developers can use them to make pages more interactively.

Why should you use JQuery?

  • jQuery is widely used
       JQuery is a quite popular JS library because of its simplicity and ease of use. you can make the most attractive web pages easily by using JQuery.
  • Promotes simplicity
        jQuery is easy to learn and intuitive as the library is built using simpler and shorter codes With its open coding standards and simple syntax, you can shorten the time that it takes to deploy a site or application.

  • Cross-browser compatibility
        One of the characteristic benefits of using jQuery is the fact that it deals with many cross-browser issues and bugs that you would experience while developing using JavaScript only.
  • Clean and beautiful syntax
         jQuery makes use of powerful, clean, and simple syntax that makes it easier to pick the DOM     elements on the webpage that you want to change with JavaScript and enables you to chain effects and actions together for effective code.
  • Lightweight and lean
        To keep the jQuery library lean and lightweight, most functions have been omitted and others have been moved to the plug-in section. If you require any of these omitted features, you can easily add them to your website as plugins.

  • Open-source library

    jQuery is an open-source library that is free and supported well across different applications. This means that anyone can use this language in their applications without worrying about any licensing or compatibility issues.

                

Features of JQuery...


  • HTML manipulation
  • DOM manipulation
  • DOM element selection
  • CSS manipulation
  • Effects and Animations
  • Utilities
  • AJAX
  • HTML event methods
  • JSON Parsing
  • Extensibility through plug-ins





jQuery selectors...



  • JQuery selectors allow you to select and manipulate HTML elements.
            syntax:
                    $(selector).action()


Jquery methods...

  • before
                The JQuery before() method inserts the specified content before the selected elements.
                syntax:
                    $(selector).before(content)
  • after
                 The JQuery after() method inserts the specified content after the selected elements.
                   syntax:
                    $(selector).after(content)
  • text
                The text method is used to set or return the text content of selected elements.
                syntax:
                    $(selector).text()
                    $(selector).text(content)
  • html
                The html method uses to return or set values/ contents to the page.
                syntax:
                    $(selector).html()
                    $(selector).html(content)
  • css
                The css method set or returns one or more style properties for the selected elements.
                    syntax:
                    $(selector).css(property name)
                    $(selector).css(property name,value)
  • attribute
                The attribute method is used to set or return the attribute values to the selected elements.
                    syntax:
                    $(selector).attr(attribute)
                    $(selector).attr(attribute,value)
  • val
            The val method is used to set or return the values to the selected elements.
                    syntax:
                    $(selector).val()
                    $(selector).val(value)




 JQuery events...

  • Click
             click event executes when the user clicks on the HTML elements.
                syntax:
                    $(selector).click(function)
                    
              when clicking on the element, the click event occurs.
              after the click event occurs it execute the click (function)
  • add class and remove class
            It adds or removes one or more class names that you want to add.
            class name - specifies one or more.
                syntax:
                    $(selector).addclass(class name)
  • toggle class
            this method toggles between adding and removing one or more to the selected elements.
                syntax:
                    $(selector).toggleclass(class name)
  • on and off methods     
            on method attaches one or more event handlers for the selected elements.
            on() binds event handlers to dynamically add elements.

            similarly off() removes event handlers that were attached with off.
            syntax:
                    $(selector).on(event,function)
                    $(selector).off(event,function)
  • keypress
            this event executed when a character is entered.
            syntax:
                    $(selector).keypress(function)
  • keydown or keyup 
            Event fired when a key is pressed or released on the keyboard.

Effects ...

there are so many effects in JQuery users can use them easily.

  • hide
  • fade in and fade out
  • show
  • slide up, slide down and slide toggle.


Comments