es5怎么在html里写三元表达式使用不同的样式,如下图和代码
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
Hello ECMA Script 6
<div id="test">a</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
var b = 5;
var c = 6;
var a = "<div " + (b > c) + " ? style='color:red' : style='color:blue'></div>";
$("#test").html(a)
</script>
</body>
</html>
慕桂英4014372
Cats萌萌
ibeautiful
皈依舞