[英]How to click a button in angular 2?
Without involving Jquery, how can the javascript of a component click an HTML button? 在不涉及Jquery的情况下,组件的javascript如何单击HTML按钮? All the documentation is for the opposite interaction of a button being on the page and handling that click, which won't work because it belongs to a
ngNoForm
element that the browser needs to handle itself. 所有文档都是针对页面上的按钮和处理该单击的相反交互,这将无法工作,因为它属于浏览器需要自己处理的
ngNoForm
元素。
You can just use a normal javascript click 您只需使用正常的javascript点击即可
Here is the doc 这是文档
https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/click
Here is an example code 这是一个示例代码
document.getElementById( "exit-cancel" ).querySelector( "a" ).click()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.