[英]How to append events or functions using jquery, from Chrome Dev Tools Console to the current page?
I'm not a front-end developer, then I'm new with jquery, now when I develop/design anything I use a lot the Console of Chrome Developer Tools to test my queries, that's so usefull. 我不是前端开发人员,所以我是jquery的新手,现在当我开发/设计任何东西时,我都经常使用Chrome开发人员工具控制台测试我的查询,这一点非常有用。
But today I faced an Issue, I need to put a click event to one div, I put the function on the View(MVC), then launch the app, pass the login, click here, click there. 但是今天我遇到了一个问题,我需要将一个click事件放到一个div上,然后将该函数放到View(MVC)上,然后启动该应用,传递登录名,单击此处,然后单击此处。 And when the moment of test is come, the event didn't worked.
当测试的时刻到来时,该事件没有进行。
Then would be fine if with jquery I could append a new click event to the div, from the Console of Chrome Dev Tools rather than change the view-compile-execute, etc. 如果使用jquery,我可以从Chrome开发者工具的控制台中向div追加一个新的click事件,而不用更改view-compile-execute等,那就很好了。
How I do that? 我该怎么做?
Thanks. 谢谢。
I'm not sure that I really got what you meant. 我不确定我是否真的明白了你的意思。 But I think what you mean is how to trigger a click event on a particular div.
但我认为您的意思是如何触发特定div上的click事件。
If that is it, you can use $("div#id").click();
如果是这样,则可以使用
$("div#id").click();
(It is a shortcut for $("div#id").trigger("click")
) (这是
$("div#id").trigger("click")
的快捷方式)
You can run this on the console, of course 您当然可以在控制台上运行它
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.