Search code examples
javascriptjqueryinternet-explorer-7

Using after() and before() in jquery for IE7 not working


Before anyone say this is a copy of another question, just so you know, I've looked around StackOverflow, but none of the answers suits to my question.

I've been trying to use .after() in jquery for IE7 but it doesn't work at all. The element I'm moving doesn't appear at all. even looking at the source, the element is not there, again in IE7.

Other than that all other browser, i.e. FF, chrome, etc, all work of them work properly.

JS/Jquery:

$('.item-title').find('.aside').after($('<a style=\"margin-left:240px; width:103px; height:19px; margin-top:0px;\" href=\"#applyDateBlock\" class=\"blue-button scrollTo\">Select a room</a>'));

HTML:

<div class="item-title">
    <div class="excerpt"></div>
    <div class="aside" style="margin-top: -13px;">
        <a class="scrollTo" href="#roomTable">some link 1</a>
        <a class="scrollTo" href="#tripAdvisorAnchor">some link 2</a>
    </div>
</div>

Solution

  • Try this:

    $('.item-title').find('.aside').after('<a style="margin-left:240px; width:103px; height:19px; margin-top:0px;" href="#applyDateBlock" class="blue-button scrollTo">Select a room</a>');