开发者

moving html element from #div to body syntax issue

i am trying to 'clone' an element and delete old, i want to do this because I have a z-index problem in IE and will do it using conditional comments:

<!--[if lte IE 7]>
<script type="text/javascript">
    $(document).ready(function() {
            var callCenter = $('#callCenter').html();
            alert(callCenter);
            $('#callCenter').remove();
            $('body').prepend("<div id='callCenter'>"+callCenter+"</div>");
    });
</script>
<![endif]-->

the problem is that the alert shows something like (without "" )

moving html element from #div to body syntax issue

So the clasenames are kind of lost

<span class=clasname> instead of <span class="clasname">

-EDIT-

Trying with

    <!--[if lte IE 7]>
<script type="text/javascript">
    $(document).ready(function() {
            $('#callCenter').prependTo('body');开发者_StackOverflow中文版
    });
</script>
<![endif]-->

is this a internet explorer thing?


This should work.

<!--[if lte IE 7]>
<script type="text/javascript">
    $(document).ready(function() {            
            var callCenter = $('#callCenter').remove().prependTo(document.body);
    });
</script>
<![endif]-->
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜