Javascript for $form items?

Permalink
I could not find any information on this. I am aware I could switch all my $form to normal html tags but I was seeing if I could keep this OO. I am trying to add javascript to

<div><?php echo $form->select('class', $classes, 'none')?></div>

and
echo $form->select('cat', $catArray[23], 1, array('style' => 'width: 150px')); ?></div>


Is there away to do this?

Thanks for any help

 
jelthure replied on at Permalink Reply
jelthure
i believe you can do this like so:

echo $form->select('cat', $catArray[23], 1, array('style' => 'width: 150px', 'onchange'=>'javascript: myFunction()')); ?>
codingpenguins replied on at Permalink Best Answer Reply
Thanks jelthure for the reply and it worked after making the extra script to an array.
echo $form->select('cat', $catArray[23], 1, array('style' => 'width: 150px', array('onchange'=>'javascript: myFunction()'));