How can I simulate a click event via script?
        Posted  
        
            by Scott B
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Scott B
        
        
        
        Published on 2010-03-15T18:36:28Z
        Indexed on 
            2010/03/15
            18:39 UTC
        
        
        Read the original article
        Hit count: 196
        
jQuery
I have a jquery accordion style menu that I'd like to add some shortcut links to across the top. When one of these shortcuts is clicked, it should have the same effect as if the user clicked the corresponding a tag that serves as that panel's header...
Here's some code...
<div>
    Application Shortcuts > <a href="" 
    onclick="simulateAclick("generalSettings")>Open General Settings</a>
</div>
<ul class="menu collapsible">
  <li class='header'><a href='#' id="generalSettings">General Settings</a>
      <ul class='acitem'>...stuff goes here...
In the example above, clicking on "Open General Settings" toggles the "acitem" UL's child elements visible. I'd just like to simulate a click on that element, from a link at the top of my app...
© Stack Overflow or respective owner