Forums

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

Home Forums JavaScript jQuery .before and .after

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

    hey everybody.

    My problem is with the jquery .before and .after methods.

    In my code i have a UL, but i need some HTML string to be placed before and after the <UL></UL>

    Here is the resulting HTML i want:









    • We ensure:

    • Speedy e-mail confirmation of your order

    • Offsite inventory tracking

    • 24×7 order placement facility

    • Online inventory management

    • Online reporting






    so all the HTML you see before the<UL> i want to be inserted via JQ. and all the code after the </UL> would be inserted via JQ as well.

    here is the JQ i have as of now:
    http://twitter.com/


    $(".iContentMid ul").before("
    ");

    $(".iContentMid ul").after("
    ");

    But the result i am getting is this:









    • We ensure:

    • Speedy e-mail confirmation of your order

    • Offsite inventory tracking

    • 24×7 order placement facility

    • Online inventory management

    • Online reporting



    Why is this happening and how can i fix it?

    #79543
    Chris Enloe
    Member

    Maybe try using an alternative method such as .append and .prepend

    http://api.jquery.com/prepend/
    http://api.jquery.com/append/

    #79544
    jamygolden
    Member

    Try wrapping the UL within div.inlineListWrap
    Then prepend and append the rest to div.inlineListWrap

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