以下是我的jQuery函数,如果可能的话,请纠正,让我知道我错在哪里。
$("#id").click(function() {
start : appendLayout(this.id) // invoking another function to do and this part is working.
stop : (function(){
if(true){ alert("please create project"); }
} ) // not working, getting error in firbug console if i change anything
});
你想干什么?你在一个函数中创建一些属性,它不是一个对象。
这是错误的:
function() {
firstName: 'Saeed',
lastName: 'Neamati'
});
这是创建对象的正确方法:
var person = {
firstName: 'Saeed',
lastName: 'Neamati'
}
简单地调用函数并在函数中编写简单的JavaScript语句:
$("#id").click(function() {
appendLayout(this.id);
if(true){ alert("please create project"); }
});