soum
soum

Reputation: 1159

.text() function does not show HTML tags like I want. How do I fix this?

I am trying to limit 300 charecters to show in a container and using this

<script>
    $(function () {
        $('.shippingMessage').append($('#forQuickViewOnly'));
        var myDiv = $('#firstPara');
        myDiv.text(myDiv.text().substring(0, 300));
        $('.productdetailtopquickview .productdetailshopnowform').appendTo($('.infoHolder'));
    });
</script>

I am trying to show <ul><li><li></ul> structure but i am getting a paragraph. In other words, the list formatting is getting stripped. Any idea how to prevent that?

Upvotes: 1

Views: 160

Answers (1)

sachleen
sachleen

Reputation: 31131

You probably want to use .html() instead of .text()

Upvotes: 6

Related Questions