jquery模拟用户行为

//demo1,not use bind
var $user = $("#recovery_database_create_wizard_domain_name");
$user.click(function(){
    alert("function with no bind");
});
$user.click();

//demo2,use bind
var user_function = function(){
    alert("this is user action simulator");
};
$user.bind("click", user_function);
$user.click();

2.toggle中的两个函数轮流执行,在click时实行

var function1 = function(){
    alert(1);
};

var function2 = function(){
    alert(2);
};

$("#recovery_database_create_wizard_server_user_name").toggle(function1, function2);

相关推荐