I have the following Prototype code acting as an observer and I'm trying to trigger off the observer, after setting the value of the select manually...
select.observe('change', this.onChange.bindAsEventListener(this));
I was originally trying to fire this off in a number of ways via jQuery, until I realized it wouldn't work. I then adopted the script, 'event.simulate.js' as outlined in this answer. The problem I'm now experiencing is that the console shows the following error...:
Uncaught TypeError: Cannot call method 'simulate' of null scripts.js?v=56:701
I thought my code was correct...:
$('div.amfinder-horizontal td:nth-child(1) select').simulate('click');
The webpage (if it's helpful) can be seen here. I hope it's an easy fix, and would appreciate any and all guidance even if it is a suggestion on how to handle this differently.
Thanks!
The
$()
method only selects via id so this statementis invalid - you can however do this
$$()
is the CSS selector method which returns an array of elements that match the selector. then usefirst()
or[0]
to identify the first element (or only) in the array which you can then run the methodsimulate()