简体   繁体   English

如何使用jquery将事件或功能从Chrome开发者工具控制台追加到当前页面?

[英]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.

相关问题 如何使用 JavaScript(来自 Dev Tools)在 Chrome 中保存完整页面? - How to save a complete page in Chrome using JavaScript (from Dev Tools)? 从Chrome Dev Tools回溯中排除jQuery - Excluding jQuery from Chrome Dev Tools backtrace 如果您从 chrome 开发工具控制台发出 http 请求,它会包含您当前所在页面的 cookie 吗? - If you issue an http request from the chrome dev tools console, will it include the cookies of the page you're currently on? 尽管Chrome Dev Tools控制台验证,jQuery slice()仍无法正常工作 - jQuery slice() Not Working Despite Chrome Dev Tools Console Verification 在Chrome Dev Tools控制台中记录jQuery对象时显示元素? - Show Elements when logging jQuery object in Chrome Dev Tools console? Chrome开发工具:使用控制台选项卡中的Javascript检查网络选项卡 - Chrome dev tools: inspect network tab using Javascript from console tab 如何在Chrome开发工具中显示自己的事件 - How can I display own Events in Chrome dev tools 如何查看从按钮单击调用到 Chrome Dev Tools 中的请求的函数? - How to view functions called from button click to a request in Chrome Dev Tools? jquery只返回dev工具控制台的第一个输入元素 - jquery only returns first input element from dev tools console Chrome开发工具 - 将事件写入时间轴 - Chrome Dev Tools - write events to the Timeline
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM