Fontello and jQuery

246 views Asked by At

There are some strange fact, when I use Fontello with jQuery.

If I add some div

<div class="qwerty" style="display: none;">
        <i class="icon-move"></i>
</div>

and if I try to clone <i> element like this

$(document).ready(function() {
            var cl = $(".icon-move").clone();
            $(cl).css("display", "block");
            $(cl).appendTo(".content-wrapper");

});

it clones OK.

But if I try to create new <i> element in DOM with jQuery and append new <i> element to the some <div> element like this

$(document).ready(function() {
            var i = $("<i>");
            $(i).appendTo(".content-wrapper");
});

then <i> element will be added, but this <i class="icon-move"></i> not show as fontello picture.

Can I create new <i> elements in DOM <i class="icon-move"></i> for fontello? Why not?

Thank you very much.

1

There are 1 answers

0
Arthur On BEST ANSWER

Need to make the code look like

<script>
        $(document).ready(function() {
            var i = $("<i>");
            $(i).addClass("icon-move");
            $(i).appendTo(".content-wrapper");
        })
</script>