Hello guys I'm trying to get the value of a div in javascript but it seems like it doesn't work.
<div class="float-child"> <div id="ShareChecksStatus"> </div> </div>
i tried this: var filter = $('#ShareChecksStatus').html();
and also this: var filter = document.getElementById('ShareChecksStatus').innerHTML;
this where i give my div a value:
if (value.securityCheckName== "ShareFilter" && value.checkStatus == "SUCCESS" && filter !== "<span>🔴</span>"){
document.getElementById('ShareChecksStatus').innerHTML = "<span>🟢</span>";
}
CodePudding user response:
I think because of the conditions that you check, the code inside the brackets do not run , try setting div value before the checks
CodePudding user response:
innetHTML refers to the plain text between a tag. so you cant assign it to a container.
document.getElementById('ShareChecksStatus') = <span>🟢</span>;
should do it. or
document.getElementById('ShareChecksStatus').innerHTML = "🟢";