Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Chapter 2: Basics of jQuery

    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 405
    Comment on it

    Hi All, In this chapter we are learn some basics, So here we go

    A jQuery statement starts with the dollar sign ($) and ends with a semicolon (;) in the which is in document ready function. $ sign defines the jQuery,


    Document Ready -

    All jquery code is written in ready function document ready means jQuery code from running before the document or page is finished loading (DOM clear)

    $(document).ready(function(){
       //code will here
    });

    All code will appeare in script tag -

    <script type="text/javascript"></script>

    jQuery Syntax -

    jQuery syntax has two major thing first for selecting HTML elements and second perform some action on the element(s).
    $(selector).action()

     

    For example :-

    $("this").hide()

    Hiding current(this) element.

    $("p").hide()

    Hiding all <p> elements.

    $(".div1").hide()

    Hiding whose class=".div1" in the elements.

    $("#div1").hide()

    Hiding whose id="div1" in the elements.


    Example of syntax flow of jQuery -

    <script type="text/javascript">
        $(document).ready(function(){
            $("div").click(function(){
                $(this).hide();
            });
        });
    </script>

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: