The bookmark is originally used to collect the URL (http://momo.site.com/), but in fact the bookmark can also collect the javascript code
Just replace the address url in the bookmark with the javascript code.
javascript:your_javascript_expression
The above javascript: can be considered as a javascript protocol, just like http: is an http protocol.
The following is the address to start the jQuery bookmark:
javascript :(
function(jquery_node){
var disable = function(src_node) {
src_node.parentNode.removeChild(src_node);
jQuery.noConflict(1);
};
var enable = function(d,j){
j=d.createElement('script');
j.id='jquery_src_code';
j.src='http://ajax. googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js';
d.getElementsByTagName('head')[0].appendChild(j);
};
! !jquery_node ? disable(jquery_node)
: enable(document);
})(document.getElementById('jquery_src_code'))
In order to allow users to collect it on the web page, you Need to put it into an
link.
For example:
The whole code is:
The results are as follows:
Start jQuery
You can bookmark the above (right-click, click "Add this link as Bookmark");
FireBug---" Console, try the charm of jQuery.
jQuery('a');
$('a') may not work because it may be there from the beginning window.$ object (contains other js libraries, or the website defines the $ object itself)
cnblogs website uses the jQuery library.
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn