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 "" )
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]-->
精彩评论