在Chrome JavaScript控制台中测试jQuery语句 [英] testing jQuery statements in Chrome JavaScript console

查看:103
本文介绍了在Chrome JavaScript控制台中测试jQuery语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从chrome JavaScript控制台更改复选框值。我知道更改打印到对象而不是屏幕上。我想执行一个jQuery语句,即:

 ('input [name = foo]')。attr('检查',true); 

有没有办法输入一个jQuery语句,并在页面中立即看到变化?

解决方案

是的,即使您没有jQuery可用,也是如此:)

编辑的代码片段如何在Google Chrome的Greasemonkey脚本中使用jQuery?

  var script = document.createElement(script ); 
script.setAttribute(src,https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js);
script.addEventListener('load',function(){
var script = document.createElement(script);
document.body.appendChild(script);
} ,假);
document.body.appendChild(script);

在此之后。


I'm trying to change a checkbox value from chrome JavaScript console. I'm aware that changes are printed to object and not on screen. I'd like to execute a jQuery statement, i.e.:

('input[name=foo]').attr('checked', true);

Is there any way to enter a jQuery statement, and and see changes instantly in the page?

解决方案

Yeah, and even if you don't have jquery available let it be :)

Edited snippet from How can I use jQuery in Greasemonkey scripts in Google Chrome?

var script = document.createElement("script");
  script.setAttribute("src", "https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js");
  script.addEventListener('load', function() {
    var script = document.createElement("script");
    document.body.appendChild(script);
  }, false);
  document.body.appendChild(script);

After this go.

这篇关于在Chrome JavaScript控制台中测试jQuery语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆