Изменить .css("margin-left")
в .css("marginLeft")
.
Like This:
$(document).ready(function(){
if ($car1.css("marginLeft") == "1060px")
$("#result").html("Car One Won The Race!!");
})
Окончательный код:
<html>
<title>This is test</title>
<head>
<style>
div {
margin-left: 1060px;
}
</style>
</head>
<body>
<div>I am div, and margin_left 1060px</div>
<p id="result"></p>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>
$(document).ready(function(){
$car1 = $("div");
if ($car1.css("marginLeft") == "1060px")
$("#result").html("Car One Won The Race!!");
})
</script>
</body>
</html>
Что именно '$ car1.css ("Левое поле")' вернуть? Добавьте некоторый контекст. – nilsole