I wrapped a class but i only want to wrap the first div.class productInfo and not the second how’s that possible?
<script>
jQuery(document).ready(function($) {
$("div.productInfo").wrap("<div id='productDetails' />");
});
</script>
and here’s the HTML
<div class="productInfo">the first div.
</div>
<div class="productInfo">the secondn div
</div>
http://api.jquery.com/first-selector/ or http://api.jquery.com/first/
I imagine
$("div.productInfo:first")or$("div.productInfo").first()will work.