Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • jQuery next() Method

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 420
    Comment on it

    The jQuery next() method gives back the next sibling components of the  component which we have selected.

    By using next() method we can select  the  next siblings of the component which we have selected and then we can use them.


    selector − it is used to select html elements in which jquery has to be applied by using either id , class or html elements.

    next() method also have an optional parameter which is explain below. [selector] )

    The selector which is  inside a brackets is  optional parameter which is used to filter the search for sibling.

    Below is the example for JQuery next() method:-

    body * { 
        display: block;
        border: 3px solid lightgrey;
        color: grey;
        padding: 6px;
        margin: 16px;
    <script src=""></script>
        $("h1").next().css({"color": "#4FB053", "border": "1px solid #4FB053"});
    <div>parent div

    In above example we are selecting  the next sibling of the <h1> tag with the help of jQuery next() method and then making its color green.

    Working demo :-

 0 Comment(s)

Sign In

Sign up using

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: