Jquery remove all elements except for first one

jquery

Using jquery remove how can i remove all the span tags except for the first one..

EDIT

 var html = var htm = $("#addin").find(".engagement_data:last-child").find(".keys_values").html();
    html='
       <span style="display:block;" class="k_v">
         <innput type="text" class="e_keys" style="width:65px;" placeholder="key"/>
         <input type="text" class="e_values" style="width:65px;" placeholder="value"/>
       </span>
       <span style="display:block;" class="k_v">
         <input type="text" class="e_keys" style="width:65px;" placeholder="key"/>
         <input type="text" class="e_values" style="width:65px;" placeholder="value"/>
       </span>
';

Best Answer

Try with:

$(html).not(':first').remove();

or to be more specific:

$(html).not('span:first').remove();

To remove it from DOM, instead of html variable, use your selector:

$('#addin .engagement_data:last-child .keys_values').not('span:first').remove();