Open at7211 opened 6 years ago
$.ajax(
{
url:data_url,
success: function(res){
console.log(JSON.parse(res));
}
}
)
var now_class="";
if(item.done == true){
now_class="done"
}
//上下意思相同,寫法不同
var now_class=(item.done==true)?"done":"";
var now_item=item_template.replace("{{name}}",item.name)
.replace("{{num}}",i+1)
.replace("{{date}}",item.date)
.replace("{{class}}",now_class);
//replace("",123)前者為替換對象,後者為給定值
$(".question").addClass("select") //注意addClass()裡面不用加.
$(".topic").on("click","title",function(){
$(this).css("border-bottom","solid 1px #358bff");
console.log("click!");
})