Hi there,

I am a newbie at using jquery and now I stumbled upon a problem. With
Jquery I want to replace each <hr/> with a <div> opening tag or a </
div> closing tag. This way I would like to place a large page of
content in different divs.

Now I have this code :

var counter = 0;
for(var i = 0; i < $('hr').size(); i++){
    if(counter == 0){
            $("hr:eq(i)").replaceWith("<div>");
            counter++;
     }else if(counter == 1){
            $("hr:eq(i)").replaceWith("</div>");
            counter = 0;
      }
}

But it replaces every <hr/> with a open and close <div> tag. Anyone
knows how I could get this working?


Reply via email to