Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript inserting <br /> between 2 paragraphs [SOLVED]

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #28001
    noahgelman
    Participant

    On a site I’m working on, I want a line break (<br />) after each paragraph (<p>), but only if there is another paragraph following it.

    If i wanted a line break after each paragraph, that would be easy enough, but because I want it only when there’s another another paragraph after it, I’m not exactly sure how to go about it.

    #70959
    Makeshift
    Member

    Here, use this.

    Code:
    $(“p:not(:last-of-type)”).after(“
    “);

    I just tried it and it gave me no issues.

    #70961
    noahgelman
    Participant

    That is fantastic. Exactly what I needed. Thank you.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.