It’s going to be something simple, but with the code below, I am getting the alert to output “VOID” but my second line of jQuery does not result in anything happening. What is the correct syntax for getting an action to occur based on some text within an ID?
HTML:
<span id="door1status">VOID</span>
jQuery:
alert ($('#door1status').text());
if ($('#door1status').text() == 'VOID') { // do something
};
The code you have should work fine, check this fiddle to see it working.
Make sure in the HTML code you have that there is only 1 element in the page with the
idofdoor1status. Repeatedidattributes are invalid and will cause issues like this.