Skip to main content


Showing posts from July, 2010

jquery - the trigger method

Having recently had to work on a client website where jquery wasn't available, it was really apparent just how useful this library is and how pleasureable it makes working with JavaScript. Having to resort back to getElementById and getElementsByClassName was painful in comparison. Today I discovered and made use of yet another useful feature - the trigger method which enables an action on one element to fire the functions associated with events on another. I had a simple accordion style user interface that looked like this: On clicking the cross on the right a panel below would expand and display the content. The mark-up looked like this:     1   < ul id ="list">     2      < li >     3          < div class ="head"> Title </ div >     4          < a href =""> + </ a >     5          < ul >     6              < li > Content one </ li >     7          </ ul >     8      </ li >