Welcome To Snipplr
Everyone's Recent JavaScript Snippets
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
Basically creates a log function on the window object and uses console.log or alert depending on which is supported. Very basic and simple but definitely useful.
0
753
posted 13 years ago by alvincrespo
Replace English numbers with Arabic numbers in browsers supporting Unicode & JavaScript.
Credits to
http://www.swalif.net/softs/swalif54/softs232281/
0
2355
posted 13 years ago by mooparmghor
Is very inefficient to attach a anonymous function event handlers to multiple items in a selection. The function is duplicated for each element.
This shows how you can just create a single function and in the event handler callback just call that...
0
646
posted 13 years ago by anagaiyahoocom
JavaScript
Simple Math Captcha-like verification JavaScript script that uses jQuery (form) validation plugin
Don't forget to include jQuery validation plugin before this snippet. You can find it here:
http://bassistance.de/jquery-plugins/jquery-plugin-validation/
0
1280
posted 13 years ago by racl101
Brilliant solution using Object.prototype.toString()
Test cases included (commented out)
0
693
posted 13 years ago by wizard04
Returns an object with the `event.button` values of both the W3C and Microsoft models.
0
825
posted 13 years ago by wizard04
These functions allow you to set a handler for a mouseleave/enter event.
0
756
posted 13 years ago by wizard04
when need to created a dom element repeatedly , use string concatenation to avoid for loop you can use repeat function from below.
0
831
posted 13 years ago by root_hacker
this is the way for toggling something on mouse hover in and out
0
1018
posted 13 years ago by root_hacker
Safely loads a javascript file asynchronously
Example:
(function() {
__safeLoadScript("http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js", function() {
alert(jQuery);
});
})();
0
670
posted 13 years ago by jasonseney
This is implementation of pseudocode given in quicksort wikipedia page. Did it just for fun :)
0
638
posted 13 years ago by naren1012