javascript - CSS selector for the next element of an element which fires onclick? -


i have element listens onclick event. calls function once clicked. after element < dd > want select in css selector. element clicked, < select >. how that?

this html:

<select onclick="myfunction();">...</select>  <dd>...</dd>  function myfunction() {     // have write ??????     $$('?????? dd').toggle(); } 

note: there many of select/dd combination, have next dd after firing element.

the minimal change is: pass this function:

<select onclick="myfunction(this);">...</select> 

...and then:

function myfunction(select) {     $(select).next().toggle(); } 

$ enhances element, can use next move next element. if like, can use .next('dd'), in case dd is next element.

that still uses onxyz attributes, bit old-hat. might consider hooking things via observe instead.


Comments