Include jQuery in the JavaScript Console

Is there an easy way to include jQuery in the Chrome JavaScript console for sites that do not use it? For example, on a website I would like to get the number of rows in a table. I know this is really easy with jQuery. $('element').length; The site does not use jQuery. Can I add it in from the command line? Run this in your browser's JavaScript console, then jQuery should be available.

在JavaScript控制台中包含jQuery

有没有简单的方法可以在Chrome JavaScript控制台中为不使用jQuery的网站添加jQuery? 例如,在网站上,我想获取表格中的行数。 我知道这对于jQuery来说非常简单。 $('element').length; 该网站不使用jQuery。 我可以从命令行添加它吗? 在您的浏览器的JavaScript控制台中运行这个,然后jQuery应该可用... var jq = document.createElement('script'); jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jque

What is the best way to remove a table row with jQuery?

用jQuery去除表格行的最佳方法是什么? You're right: $('#myTableRow').remove(); This works fine if your row has an id , such as: <tr id="myTableRow"><td>blah</td></tr> If you don't have an id , you can use any of jQuery's plethora of selectors. @Eikern If you're gonna use jQuery, use jQuery man! $('#myTable tr').click(function(){ $(this).remove()

用jQuery去除表格行的最佳方法是什么?

用jQuery去除表格行的最佳方法是什么? 你是对的: $('#myTableRow').remove(); 这工作正常,如果你的行有一个id ,如: <tr id="myTableRow"><td>blah</td></tr> 如果你没有id ,你可以使用任何jQuery的选择器。 @Eikern 如果你要使用jQuery,请使用jQuery man! $('#myTable tr').click(function(){ $(this).remove(); return false; }); 假设你在表格中的数据单元格内有一个按钮/

Remake JS and jQuery into AngularJS

This question already has an answer here: “Thinking in AngularJS” if I have a jQuery background? [closed] 15 answers I suggest you to start with some tutorials (codescool offer the best one in my opinion) Then google is my encyclopedia about single cases. If you post some case probably we can help you but your question is too general to have an answer Angular1 is noting but organised JS

将JS和jQuery重新转换为AngularJS

这个问题在这里已经有了答案: “在AngularJS中思考”如果我有一个jQuery背景? [已关闭] 15个回答 我建议你从一些教程开始(在我看来,codescool提供最好的教程) 然后谷歌是我的关于单例的百科全书。 如果您发布了一些案例,可能我们可以帮助您,但您的问题太笼统,无法得到答案 Angular1注意到,但组织JS,你有控制器和相关的意见,它可以完全写在普通的JS,但你需要了解编写控制器的角度格式。 另一方面,Angular2

Loading jQuery after AngularJS

This question already has an answer here: “Thinking in AngularJS” if I have a jQuery background? [closed] 15 answers Inside your angular controller corresponding to that view, you can do the following: .controller('MyCtrl', [function($scope) { $scope.$on('$viewContentLoaded', function(){ // here your jQuery code }); }]); Few precisations: angular already has its builtin ver

在AngularJS之后加载jQuery

这个问题在这里已经有了答案: “在AngularJS中思考”如果我有一个jQuery背景? [已关闭] 15个回答 在角度控制器内部对应于该视图,您可以执行以下操作: .controller('MyCtrl', [function($scope) { $scope.$on('$viewContentLoaded', function(){ // here your jQuery code }); }]); 几个精度:角度已经有其内置版本的jQuery(jQlite),你应该使用jQlite,而不是每次都可以使用jQuery。 此外,你应该避

JavaScript equivalent to printf/string.format

I'm looking for a good JavaScript equivalent of the C/PHP printf() or for C#/Java programmers, String.Format() ( IFormatProvider for .NET). My basic requirement is a thousand separator format for numbers for now, but something that handles lots of combinations (including dates) would be good. I realize Microsoft's Ajax library provides a version of String.Format() , but we don't w

相当于printf / string.format的JavaScript

我正在寻找C / PHP printf()或C#/ Java程序员的String.Format() (用于.NET的IFormatProvider )的JavaScript等价物。 我现在的基本要求是数字分隔格式,但处理大量组合(包括日期)的东西会很好。 我意识到微软的Ajax库提供了一个String.Format()版本,但我们不希望这个框架的整个开销。 试用JavaScript的sprintf()。 更新好吧,如果你真的想自己做一个简单的格式化方法,不要连续进行替换,而是同时进行替换。 由

Is there an event like hashchange for query strings?

I have been using hashes to pass data between pages (like setting scrollTop() , etc.) and have also used the hashChange event to trigger changes on a given page. However, hashes have default behaviors that I'm not necessarily interested in, like making the page jump to a given (sometimes insignificant) spot. I feel like getting/setting a query string would be more logical, but: Is it?

是否有像查询字符串hashchange事件?

我一直使用哈希在页面之间传递数据(如设置scrollTop()等),并且还使用hashChange事件触发给定页面上的更改。 但是,哈希具有我不一定感兴趣的默认行为,如使页面跳转到给定(有时不重要)的位置。 我觉得要设置一个查询字符串会更合乎逻辑,但是: 是吗? 查询字符串设置时是否有可以侦听的事件? 是否有我应该了解的与查询字符串相关的行为? 重塑锚定行为是不合逻辑的。 最好不要将散列链接暴露给无关紧要的片

What's the difference between window.location and document.location in JavaScript?

他们是否应该引用同一个对象? According to the W3C, they are the same. In reality, for cross browser safety, you should use window.location rather than document.location . See: http://www.w3.org/TR/html/browsers.html#dom-location The canonical way to get the current location object is window.location (see this MSDN page from 1996 and the W3C draft from 2006). Compare this to document.locati

在JavaScript中window.location和document.location有什么区别?

他们是否应该引用同一个对象? 根据W3C,他们是一样的。 实际上,对于跨浏览器安全性,您应该使用window.location而不是document.location 。 请参阅:http://www.w3.org/TR/html/browsers.html#dom-location 获取当前位置对象的规范方式是window.location (请参阅1996年的此MSDN页面和2006年的W3C草稿)。 将它与document.location进行比较,最初只将当前URL作为字符串返回(请参阅MSDN上的此页)。 可能为了避免混淆

Request address in JavaScript

Possible Duplicate: Get current URL with JavaScript? How do you get the address of the page you are on in JavaScript? For example, if I had a script at somesite.com/javascript/home.html and I want to find out the request address ( somesite.com/javascript/home.html ), how do I get this information in JavaScript? You need to use: document.location or window.location You can read more here

请求地址在JavaScript中

可能重复: 使用JavaScript获取当前网址? 你如何获得你在JavaScript中的页面的地址? 例如,如果我在somesite.com/javascript/home.html有一个脚本,并且想要查找请求地址( somesite.com/javascript/home.html ),那么我如何通过JavaScript获取这些信息? 您需要使用: document.location或window.location 你可以在这里阅读更多。 或者在那里有更多的解释。 澄清事情: 最初由Mozilla开发者中心发布 docume

Get protocol, domain, and port from URL

I need to extract the full protocol, domain, and port from a given URL. For example: https://localhost:8181/ContactUs-1.0/contact?lang=it&report_type=consumer >>> https://localhost:8181 first get the current address var url = window.location.href Then just parse that string var arr = url.split("/"); your url is: var result = arr[0] + "//" + arr[2] Hope this helps var full =

从URL获取协议,域和端口

我需要从给定的URL中提取完整的协议,域和端口。 例如: https://localhost:8181/ContactUs-1.0/contact?lang=it&report_type=consumer >>> https://localhost:8181 首先得到当前地址 var url = window.location.href 然后解析该字符串 var arr = url.split("/"); 你的网址是: var result = arr[0] + "//" + arr[2] 希望这可以帮助 var full = location.protocol+'//'+location.hostname+(location.port

XMLHttpRequest SOAP request with Windows Authentication

I'm trying to make SOAP request to Microsoft server using XMLHttpRequest (firefox) with different authentication schemes allowed on the server. var xmlhttp = new XMLHttpRequest(); xmlhttp.open('POST', url, true); xmlhttp.setRequestHeader("Content-Type", "text/xml; charset=UTF-8"); xmlhttp.setRequestHeader("Connection", "keep-alive"); xmlhttp.onreadystatechange = function () { if (xmlhtt

带有Windows身份验证的XMLHttpRequest SOAP请求

我正在尝试使用XMLHttpRequest(firefox)向服务器发送SOAP请求,Microsoft服务器允许使用不同的身份验证方案。 var xmlhttp = new XMLHttpRequest(); xmlhttp.open('POST', url, true); xmlhttp.setRequestHeader("Content-Type", "text/xml; charset=UTF-8"); xmlhttp.setRequestHeader("Connection", "keep-alive"); xmlhttp.onreadystatechange = function () { if (xmlhttp.readyState == 4) { if (xmlhttp.st