Example:
<div id="Elmnt_1" class="MyElement">
<div id="Elmnt_2" class="MyElement">
<div id="Elmnt_3" class="MyElement">
<div id="Elmnt_4" class="MyElement">
How to select all element which have class="MyElement" and omit one element from it using specific id
My guess:
var fltrdElmnts = $(".MyElement").filter(! $( "#Elmnt_2" ) );
fltrdElmnts.remove();
Expected result:
<div id="Elmnt_2" class="MyElement">
$('#Elmnt_3')when you just want to get that element only?fltrdElmnts.remove();which is unnecessary, if you just want one element.