You can call a function clickwith no arguments that causes an artificial click. For instance:.
$("selector for the element").click();
jQuery ( ) DOM0. , , addEventListener/attachEvent DOM2, : |
jQuery(function($) {
$("#target").click(function() {
display("<code>click</code> received by jQuery handler");
});
document.getElementById("target").onclick = function() {
display("<code>click</code> received by DOM0 handler");
};
document.getElementById("target").addEventListener(
'click',
function() {
display("<code>click</code> received by DOM2 handler");
},
false
);
display("Triggering click");
$("#target").click();
function display(msg) {
$("<p>").html(msg).appendTo(document.body);
}
});
(), onclick="..." DOM0; .
, , , ; (), , .
, , ; , , , , . , , .