首页 > 解决方案 > 使用 Javascript/Jquery (Tampermonkey) 单击 Angular JS 元素

问题描述

我正在编写 Tampermonkey 脚本以向现有网站添加更多功能,并且我正在尝试单击具有以下源代码的按钮:

<label _ngcontent-c10="" ngbbuttonlabel="" class="btn btn-agree ng-star-inserted">
      <input _ngcontent-c10="" ngbbutton="" type="radio" value="AGREE" ng-reflect-value="AGREE" name="decision">YES 
</label>

输入单选按钮隐藏在父标签元素后面。

我尝试使用:(那个特定按钮radio_element.click()在哪里)单击单选按钮radio_element,但这只是将状态更改为活动状态。radio_element.checked = true似乎也不起作用。

标签: jqueryangularjsjquery-eventstampermonkey

解决方案


推荐阅读