-1

Possible Duplicate:
Fake “click” to activate an onclick method

I want to simulate false click when a user click on other div. Is this possible?

Community
  • 1
  • 1

1 Answers1

2

If by "fake click" you mean to invoke the onclick event handler for a DOM object programmatically, then do it like this:

$("#myDiv").click( function() {
    $("someOtherElement").click();
} );

The first line assigns a new onclick event handler to <div id="myDiv">. When that element is clicked it will make the <div id="someOtherElement"> behave as though it, too, was clicked by the user.

Dai
  • 141,631
  • 28
  • 261
  • 374