{Solved}:How can u add for example advertisements after 10

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
mekha
Forum Contributor
Posts: 112
Joined: Sat Mar 31, 2012 6:50 am

{Solved}:How can u add for example advertisements after 10

Post by mekha »

How can u add for example advertisements after 10 divs in jquery?
Last edited by mekha on Wed May 02, 2012 7:15 am, edited 1 time in total.
mekha
Forum Contributor
Posts: 112
Joined: Sat Mar 31, 2012 6:50 am

Re: How can u add for example advertisements after 10 divs i

Post by mekha »

i added this:

Code: Select all

$('.div1').each(function(i,e){
  if (((i+1) % 3) == 0)
    $(this).after('<div class="div4"><p style="line-height:3px;">دعاية هنا</p></div>');
});
but the slideToggle in the div before this code .after ... doesnt work :\
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Re: How can u add for example advertisements after 10 divs i

Post by pickle »

Not a lot of details, so I'm going to assume you simply have 10 divs on a page.

Code: Select all

var advertisement = a jquery object representing the advertisement
$("div:eq(9)").after(advertisement);
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
mekha
Forum Contributor
Posts: 112
Joined: Sat Mar 31, 2012 6:50 am

Re: How can u add for example advertisements after 10 divs i

Post by mekha »

thank you ;)))))))
Post Reply