S
S
synapse_people2016-09-28 16:09:43
JavaScript
synapse_people, 2016-09-28 16:09:43

How to emulate clicking on a radio button from a chrome extension?

In general, there is a content script in it such code:

$('#input_1').prop("checked", true).trigger("click").trigger("change");

on the page, it seems like it is clear that the radio button is selected correctly, but the events do not occur ...
why?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
M-ka, 2016-09-28
@M-ka

"why?"
Read about how triggers work... pay attention to "Note:"
api.jquery.com/trigger

S
synapse_people, 2016-09-28
@synapse_people

even if this script is inserted into the page itself (via the javascript protocol: ... or inject a new

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question