I am facing an issue with my HTML code, which looks like this:
<div id ="div1">
<a class="dropdown-item" href="#" id="success">
<i class="" id="successIcon"></i>
// I need to add the text Success here
</a>
</div>
When using JavaScript,
Var divId = document.getElementById('div1');
$(divId).find('#success').append("Success"); // Appends "Success" every time the page is loaded.
Even after trying the following,
$(divId).find('#success').text("Success");
$(divId ) .find("#successIcon").attr("class", "fa fa-success text-success");
// The icon "Success" is not added in front of the text "Success" when using text().
I require both the Text
and the Icon
before the text.
Could someone assist me with this problem?
Thank you very much.