Uzair Nadeem
Uzair Nadeem

Reputation: 745

Font awesome in Javascript / Jquery

I want to use font awesome tags in my javascript code. I am doing this in following way but it is not working.

if ($("#showOrderDetail_" + Id).css('display') == 'none') {

    $("#showOrderDetail_" + Id).show();
    $("#viewOrHideDetail_" + Id).html("Hide Details <i class='fa fa- chevron - up' aria-hidden='true'></i>");

} else {

    $("#showOrderDetail_" + Id).hide();
    $("#viewOrHideDetail_" + Id).html("View Details <i class='fa fa- chevron - down' aria-hidden='true'></i>");

}

Upvotes: 1

Views: 152

Answers (1)

Code Lღver
Code Lღver

Reputation: 15603

A Class name conn't have space. If you have more than one class then give the each class name with space.

You code must be like this:

$("#viewOrHideDetail_" + Id).html("Hide Details <i class='fa fa-chevron-up' aria-hidden='true'></i>");
                                                             ^^^^
                                                             check here

The class name is fa-chevron-up in font-awesome.

Same for another line also.

Upvotes: 2

Related Questions