Zyfella
Zyfella

Reputation: 70

dispatchEvent() is not a function

i have a function , in it i want to fire an event whenever the input value changes.

            var input = me.lengthSelector; //'lengthSelector': '.fv--table-length input'

            // Create a new 'change' event
            let event = new Event('change');
            // Dispatch it.
            $(input).dispatchEvent(event);

so whenever the event "change" is fired, a function onChange() would be executed that is defined somehwere else and functions correctly. but why does it say dispathcEvent() is not a function in the console ? i tried using trigger() but is says the same thing :(

Upvotes: 1

Views: 3555

Answers (1)

Flex Elektro Deimling
Flex Elektro Deimling

Reputation: 1619

its just input.dispatchEvent(event). this is not a jquery function

Upvotes: 2

Related Questions