element insertAfter for each instance
Hi.
Kindly asking for help.
I have such code
- jQuery(document).ready(function(leftmapjen)
{
//moving price and adding class for my styles
jQuery('span.ihf-for-sale-price:eq(0)').insertAfter('div.ihf-results-photo:eq(0)').addClass("buy-wdevise-price");
jQuery('div.ihf-results-price:eq(0)').insertAfter('span.ihf-for-sale-price:eq(0)').addClass("label-status label-status-7 label");
jQuery('div.ihf-results-address:eq(0)').insertAfter('div.ihf-results-price:eq(0)').addClass("buy-title");
//2
jQuery('span.ihf-for-sale-price:eq(1)').insertAfter('div.ihf-results-photo:eq(1)').addClass("buy-wdevise-price");
jQuery('div.ihf-results-price:eq(1)').insertAfter('span.ihf-for-sale-price:eq(1)').addClass("label-status label-status-7 label");
jQuery('div.ihf-results-address:eq(1)').insertAfter('div.ihf-results-price:eq(1)').addClass("buy-title");
//3
jQuery('span.ihf-for-sale-price:eq(2)').insertAfter('div.ihf-results-photo:eq(2)').addClass("buy-wdevise-price");
jQuery('div.ihf-results-price:eq(2)').insertAfter('span.ihf-for-sale-price:eq(2)').addClass("label-status label-status-7 label");
jQuery('div.ihf-results-address:eq(2)').insertAfter('div.ihf-results-price:eq(2)').addClass("buy-title");
});
How can I transform it to work in loop? So I don't want to have such hume number of similar functions. Thanks.