Wednesday, October 10, 2012

Remove next elements in jQuery

>>  This peace of code will remove Next input fields :

          jQuery("#selector").nextAll('input:hidden').remove();        // Input type "hidden"
          jQuery("#selector").nextAll('input:text').remove();            // Input type "text"

// By the above code All the input field after the selector will remove

          jQuery("#selector").next('input:hidden').remove();        // Input type "hidden"
          jQuery("#selector").next('input:text').remove();            // Input type "text"

// By the above code only the next input field of the selector will remove