Welcome To Snipplr

Everyone's Recent JavaScript Snippets

From @blixt http://stackoverflow.com/users/119081/blixt As you can see, the classes correctly interact with each other (they share the static id from MyClass, the announce method uses the correct get_name method, etc.) One thing to note is the...
1 271 posted 6 years ago by rickygri
How to download file from file cabinet
0 319 posted 7 years ago by NSahu
Simulates a click on a page with the name you put in the parameter in the onclick function.
1 349 posted 7 years ago by Reiff
Simple functions to add, fetch or delete cookies in the browser via JavaScript.
0 189 posted 7 years ago by deanhouseholder
- I have not tested on android - This is not animated as I did not need it for my needs. To make it animated, look at the second to last line in the function `layer3.transform = Ti.UI.create2DMatrix().rotate(angle);` You should be able to animate th...
0 322 posted 7 years ago by rondog
Javascript to open a URL in a new window without triggering a browser's pop-up blocker. (May not work in callbacks, but not sure why.)
1 554 posted 7 years ago by eklemen
Sometimes you need the page dynamically changes a texbox with a dropdown box. On the example below we show you how to perform this work. The first way demonstrates how to do this with remove() and append() jQuery methods and the second shows how to p...
1 1082 posted 7 years ago by apphp-snippets
Class member encapsulation in JavaScript is very important thing and may be implemented with easy. To define private property or method just use var before the definition or this., if you need to give a public access to property or method.
0 282 posted 7 years ago by apphp-snippets
In this article I will show you how to use AngularJS and Laravel Blade together. People who have been using AngularJS for a while may know of this solution. However if you are just getting started or have never used Angular with a templating engine...
0 323 posted 7 years ago by CreativePunch
Add / Remove comma for number in the thousands. Ex: 1,000 Useful for grabbing input values to format then display, remove the comma and convert back to number to do math.
0 661 posted 7 years ago by supawaza
Dynamic equal height columns that account for padding and borders.
1 267 posted 7 years ago by o0110o
Calculates the time in hh:mm:ss between two dates Usage: var past = new Date('1/1/2013'); var now = new Date(); var lapsed = past.lapsed(now);
0 193 posted 7 years ago by camdagr8
Function enables the reading of url appended variables. See URL for more information.
0 271 posted 7 years ago by gromitski
Uses the object prototype to extend data. Instantiate as an object and use as specified below (bottom of the code)
0 259 posted 7 years ago by rickygri
A quick function that makes it easy to convert an integer into a number string with commas inserted.
0 209 posted 7 years ago by uberdragon
Usage: var a = ['a','a','a']; var b = a.AllValuesSame(): //true var a ['1','1','2']; var b = a.AllValuesSame(); //false
0 549 posted 7 years ago by uberdragon
This will calculate the ticks for google charts so that you can have a chart with a defined height, and still represent large data ranges with out all the vertical information getting bunched up together.
0 190 posted 7 years ago by uberdragon
I don't really know how other people do this kind of thing, but this was my take.
0 263 posted 7 years ago by domramirez
You can put the user's cursor inside a text box or put focus on select box as soon as your page is loaded. This helps ensure that visitors do not 'overlook' an important form item on your site and this snippet only uses one line of code!
0 210 posted 7 years ago by apphp-snippets
Nowadays majority of sites uses the jQuery JavaScript library. A lot of them also make use of Google's hosted version of the library from some reasons: faster loading, better cross site caching etc. However, what if there is ever a problem and jQuery...
0 200 posted 7 years ago by apphp-snippets
More info: http://stackoverflow.com/questions/10908562/is-there-something-similar-to-window-load-for-executing-a-function-after
0 288 posted 7 years ago by rickygri
* Used to create markers based solely on latitude and longitude * Replace the existing mainPoints() function in map-functions.js
0 229 posted 7 years ago by tymartist
0 267 posted 7 years ago by thesmu
$(document).ready(function() { // Handler for .ready() called. });
0 295 posted 7 years ago by thesmu
How would you validate the number of days in a given month?
0 342 posted 7 years ago by satie83
Include any external text file within html; HTML, CSS and Javascript all work.
0 284 posted 7 years ago by nshakin
Self updating javascript copyright date
0 230 posted 7 years ago by nshakin
Works in SP2013 (and I believe 2010). Provides site collection URL without trailing "/"
0 264 posted 7 years ago by rumremix
jQuery Validate is used in ASP.Net MVC 4. As it is checking only en-US as a default you may have problems with different cultures for decimal inputs and dates (I had to try for minutes to find a accepted date format. I don't want to see how my custom...
0 247 posted 7 years ago by SnipplrSlush
Show alternative views of your page, depending on a hashtag
0 188 posted 7 years ago by jbernus