Profile
Achievement
jasonseney's Recent SnippetsTagged javascript
- All /
« Prev 1 Next »
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
702
posted 13 years ago by jasonseney
Similar to [Get Elements by Class Name]( http://snipplr.com/view/1696/get-elements-by-class-name/), but with optional "tag" parameter. Performance is increased by first retrieving the desired tag if available.
0
797
posted 14 years ago by jasonseney
Returning a boolean inside of jQuery's $.each() function will only break the loop. To get a return value, you can convert the jQuery object to array and use a regular for loop in javascript.
0
1039
posted 15 years ago by jasonseney
Based on some comments in [StackOverflow Question](http://stackoverflow.com/questions/95875/javascript-check-to-see-if-a-variable-is-an-object "How to check if a variable is an object")
3
1029
posted 15 years ago by jasonseney
Example:
`var result = "Hello {0}! This is {1}.".format("world","foo bar");`
Returns:
`"Hello World! This is foo bar."`
2
1150
posted 16 years ago by jasonseney