<html>
<input type="checkbox" checked="checked" name="isAllow"/>isAllow
<a href="#bbb">go to hell</a>
</html>
console.log($("input").attr("checked"));
console.log($("input").prop("checked"));
console.log($("a".attr("href"));
console.log($("a".prop("href"));
<html>
<div id="target">
</div>
</html>
$("#target").html("<div>Oh~ my~</div>");
$("#target").empty();
$("#target").after("<div>after</div>");
$("#target").before("div>before</div>");
$("<div>ha ha ha</div>").appendTo($("#target"));
if(val == undefined || val = null) {
//bla
}
if(!val) {
//bla
}
var obj = src || { name : "joe" };
var obj = src && { name : "original" };
var timeoutId = setTimeout(function() {
console.log("1st job is done");
}, 1000);
var asyncJob;
asyncJob = function() {
var dfd = new $.Deferred();
setTimeout(function() {
dfd.resolve();
}, 1000);
return dfd.promise();
};
asyncJob()
.done(function() {
console.log("job is done");
})
.then(function() {
return "arg1";
})
.then(function(arg) {
console.log(arg);
});
var arr = [ {
"name" : "joe"
}, {
"name" : "james"
} ];
for(var i = 0, len = arr.length; i < len; i++) {
var str = "<div>" + obj.name + "</div>";
}
{{#each comments}}
<h2><a href="/post/ {{ name }}#{{id}}">{{title}}</a></h2>
<div>{{body}}</div>
{{/each}}