I'm trying to including a css "left" property to my javascript code such that if the left property in the css file matches the one in the javascript code, a certain action takes place. Any help will be appreciated. The HTML code is:
<!DOCTYPE HTML>
<html>
<head></head>
<body>
<button id = "myBtn">MyButton<button>
<p id= "demo"></p>
</body>
</html>
The CSS code is:
#myBtn {
position: absolute;
left: 100px;
}
The script code is:
<script>
if (document.getElementById("myBtn").style.left == "100px") {
actionX //this is just an example
}
document.getElementById("demo").innerHTML = actionX;
</script>