jQuery | How to hide all right siblings

| By Webner

If you want to hide all following siblings of an element with jQuery then you can use next() function. This function is used to get following siblings (means siblings that occur after selected element) of matched element. If a selector is provided, it retrieves the next sibling only if it matches that selector. These are some examples:

$(.selector).parent().next().css('display','none');//hide siblings using class
$(#id).parent().next().css('display','none');//hide siblings using id

Webner Solutions is a Software Development company focused on developing CRM apps (Salesforce, Zoho), LMS Apps (Moodle/Totara), Websites and Mobile apps. If you need Web development or any other software development assistance please contact us at webdevelopment@webners.com

Leave a Reply

Your email address will not be published. Required fields are marked *