$(\'[id]\').each(function () { var ids = $(\'[id=\"\' + this.id + \'\"]\'); // remove duplicate IDs if (ids.length > 1 && id
you can try
$("#ID").nextAll().remove();