Home > database >  Get the value of a html div
Get the value of a html div

Time:11-08

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>&#128308;</span>"){
        document.getElementById('ShareChecksStatus').innerHTML = "<span>&#128994;</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>&#128994;</span>;

should do it. or

document.getElementById('ShareChecksStatus').innerHTML = "&#128994";
  • Related