Forums

Add event option

01 17 Oct, 2012
Hi!
It'd be nice to be able to add events, such as onClick to elements through the Wizard Edit.
For example now I'm not able to attach event to each checkbox.
GreyHead 17 Oct, 2012
Hi 01,

It not such good practice to add them in the HTML; better to keep them separate and add from a Load JS action. Here's some code I posted yesterday that adds On Click events to a whole group of radio buttons:
window.addEvent('domready', function(){
  radio_group = $$('div#radio_group input[type=radio]');
  radio_group.each( function(item) {
    item.addEvent('click', checkRadio);
  });
});
This calls the checkRadio() function on click but it could do anything you need.

Bob
01 17 Oct, 2012
HI, GreyHead!
Thank you!
will use it
This topic is locked and no more replies can be posted.