Welcome To Snipplr


Everyone's Recent JavaScript Snippets Tagged javascript



Simple functions to add, fetch or delete cookies in the browser via JavaScript.
0 77 posted 6 years ago by deanhouseholder
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 303 posted 6 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 492 posted 6 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 116 posted 6 years ago by apphp-snippets
Dynamic equal height columns that account for padding and borders.
1 122 posted 6 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 71 posted 6 years ago by camdagr8
Function enables the reading of url appended variables. See URL for more information.
0 119 posted 6 years ago by gromitski
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 82 posted 6 years ago by apphp-snippets
How would you validate the number of days in a given month?
0 152 posted 7 years ago by satie83
Include any external text file within html; HTML, CSS and Javascript all work.
0 132 posted 7 years ago by nshakin
Self updating javascript copyright date
0 98 posted 7 years ago by nshakin
Works in SP2013 (and I believe 2010). Provides site collection URL without trailing "/"
0 101 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 103 posted 7 years ago by SnipplrSlush
Show alternative views of your page, depending on a hashtag
0 78 posted 7 years ago by jbernus
For side by side ULs that become too wide on small screens/devices. The following script let you merge or unmerge ULs depending on the size of the screen/device. Works with jQuery
0 103 posted 7 years ago by jbernus
Assuming that by empty means "has no properties of its own"
0 98 posted 7 years ago by satie83
This is a really basic skeleton template for jQuery plugins. It provides a callback function which can be called anywhere in your plugin with base.success(); This will return the current element, but you can pass anything you like back by changing th...
0 117 posted 7 years ago by rickygri
It currently uses redis as a store for the data. The url's are pretty long since it's all base64 encoded data and the images are returned as base64 encoded PNG's but that can be solved pretty easily. This could be used a service for something kind of...
0 87 posted 7 years ago by redhatmatt
Used to stretch a video / image to fill a background without skewing. Attach to resize events
0 124 posted 7 years ago by rickygri
This is a simple fix for the iOS zoom bug that happens when changing screen orientations.
0 103 posted 7 years ago by bitsculptor
Use Javascript to check if JQuery is loaded properly in the browser
1 113 posted 7 years ago by nshakin
The following code fetches contents of each Title field from the list called "LandingMiddleLinks"
0 185 posted 7 years ago by rumremix
Use a regex to check the email address input
4 238 posted 7 years ago by dreamstarter
simple code of using Ajax by JavaScript or jQuery
0 138 posted 7 years ago by codingforever99
The use of dynamic data acquisition on modern web sites and in a lot of intranet applications, sometimes means we have to build structures dynamically as data comes in from a feed or AJAX operations. The problem is not with the data, but rather that...
0 106 posted 7 years ago by COBOLdinosaur
This simple scripts show a possibility to call a JavaScript function that retrieves a variable passed from drop down box as a parameter and then the JavaScript redirects the browser to the variable that was passed to it.
0 107 posted 7 years ago by apphp-snippets
This script informs your visitor that a given page may be reached only from the page that you specify. Paste this code before the ending <head> tag on the page:
1 108 posted 7 years ago by apphp-snippets
One of the important things about user input is to verify that the user has supplied the email that you have requested. The function below allows you to verify email address with easy.
1 136 posted 7 years ago by apphp-snippets
You may perform this work with two ways: pass it directly like described in sample #1 or use an anonymous function like its shown in sample #2.
0 214 posted 7 years ago by apphp-snippets
This function allows you to pass two variables that represent ID of two elements on your page. What you click on one of them it hide it and shows another one.
1 92 posted 7 years ago by apphp-snippets