Simulating click and change with Prototype - Simulate.js

Brian Schroeter

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!

Geek Num 88

The $() method only selects via id so this statement

$('div.amfinder-horizontal td:nth-child(1) select').simulate('click');

is invalid - you can however do this

$$('div.amfinder-horizontal td:nth-child(1) select').first().simulate('click');

$$() is the CSS selector method which returns an array of elements that match the selector. then use first() or [0] to identify the first element (or only) in the array which you can then run the method simulate()

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Simulate Button Click With Event Change [AS3]

From Dev

Simulate click on GMail div button with JS

From Dev

Simulate click event on raphael js path

From Dev

Simulating a mouse click in R

From Dev

change audiosource on click JS

From Dev

simulating click event of a different selector

From Dev

simulating click event of a different selector

From Dev

How to simulate a click on a html form through JS and JQuery?

From Dev

dc.js simulate click on chart and trigger filter on

From Dev

Bug when simulating input change with Enzyme.js - state incorrectly udpated

From Java

Simulate a button click in Jest

From Dev

Simulate Mouse Click error

From Dev

Simulate a click on admob (Android)

From Dev

Simulate button click with JavaScript

From Dev

Simulate a click with a URL parameter

From Dev

Simulate click on a minimized program

From Dev

Simulate left click in java?

From Dev

Simulate click on html?

From Dev

Error simulating click on menu item with Robolectric

From Dev

Simulating a mousedown, click, mouseup sequence in Tampermonkey?

From Dev

PHP simulating a click on a div when the page loads

From Dev

Error simulating click on menu item with Robolectric

From Dev

Screen blacks out when simulating left click

From Dev

jquery: simulating a click via jquery - not working

From Dev

State is not getting changed after simulating click event

From Dev

Node.js change Number object value inside prototype

From Java

Simulating input change in functional component with Enzyme

From Java

How to change video js source with a link click

From Dev

change the text of the button on click using angular JS