963 B
963 B
+++ title = "jquery" draft = false tags = [ "code", "javascript", "frameworks", "jquery" ] date = "2013-03-12" +++
Jquery
Eigen CSS filters maken
$.expr[':'].external = function(elem,index,match) {
var url = elem.href || elem.src,
loc = window.location;
return !!url.match(new RegExp('^' + loc.protocol + '//' + '(?!' + loc.hostname + ')' ));
};
// You can now use it within your selectors:
// Find all external anchors:
$('a:external');
// Find all external script elements:
$('script:external');
// Determine if link is external:
$('a#mylink').is(':external'); // true/false
Via Things you may not know about jQuery
Data meegeven aan events
for(myObj in myObjects) {
$('.tr').bind('click', myObj, function(e) {
e.data.doeIets(); // .data ##### myObj
});
}
Werkt ook voor live()
.