Welcome To Snipplr
Everyone's Recent Snippets Tagged javascript
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
Loading external scripts on demand the smart way with Head JS
0
675
posted 13 years ago by kevinlearynet
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
754
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
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
1281
posted 13 years ago by racl101
If your page has already sent headers to the browser you cant redirect with headers('Location:' . $url);
But you can use the following:
0
671
posted 13 years ago by prwhitehead
Brilliant solution using Object.prototype.toString()
Test cases included (commented out)
0
696
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
758
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
832
posted 13 years ago by root_hacker
No need to create a seperate function for this one. Just one line to clear the default value on click and leave the value when it has been altered.
1
792
posted 13 years ago by dyteq
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
676
posted 13 years ago by jasonseney
This is implementation of pseudocode given in quicksort wikipedia page. Did it just for fun :)
0
641
posted 13 years ago by naren1012
Valiodate a form with jQuery.Validate and submit it with jQuery.form
1
706
posted 13 years ago by marzsman