抱歉,我是 TypeScript 的新手。我有以下代码,我想我犯了一些错误,
HTML
<script src="hello.js"></script>
</head>
<body>
<h1>TypeScript HTML App</h1>
<div id="content"></div>
</body>
打字稿
/// <reference path="jquery.d.ts" />
interface mysite {
name: string;
url: string;
}
function Show(site: mysite) {
return site.name + " at http://" + site.url + "/";
}
window.onload = () => {
var el = document.getElementById('content');
el.innerHTML = Show({ name: "Delphian", url: "stackoverflow.com/users/602714/delphian" });
//$(el).css("color", "red");
$("el").css({"color": "red" });
};
我尝试了很多方法来在 HTML DIV 元素上获得这种 CSS 效果,但没有得到。我犯了什么错误?请建议.. 更新 Javascript
function Show(site) {
return site.name + " at http://" + site.url + "/";
}
window.onload = function () {
var el = document.getElementById('content');
el.innerHTML = Show({ name: "Delphian", url: "stackoverflow.com/users/602714/delphian" });
$("#content").css({ "color": "red" });
};