Welcome To Snipplr
Everyone's Recent jQuery Snippets
- All /
- JavaScript /
- HTML /
- PHP /
- CSS /
- Ruby /
- Objective C
myEls should be the selector statement for whatever elements you want to effect. The example wraps every 3.
1
1216
posted 11 years ago by adambundy
Handy code snippet for keeping track of the number of characters a user is entering into a textbox or textarea. It will dynamically update the count as the user is typing. This also works with copy & paste.
The top snippet will automatically calcu...
2
817
posted 11 years ago by mattvbiggs
I have made a small jQuery snippet to demo the image swapping with attr() funciton. The demo uses 2 images with classes img1 and img2 respectively. On a click of a button, the images are swapped.
Basically the script stores “src†value into...
0
878
posted 11 years ago by vijayrajesh
By storing or by having the Iframe embed code as a variable, You can play the Youtube video on a click of a button or any other event. I have used “append†function of jQuery to append the IFrame code dynamically inside a DIV tag.
0
1743
posted 11 years ago by vijayrajesh
The thumbnails of Youtube videos are generally low in quality. Sometimes, the thumbnail is not enough to get the people attention. Here is a small code I have written that works as follows.
A custom thumbnail is displayed at the size of 560px wi...
0
1149
posted 11 years ago by vijayrajesh
in jquery mobile, .html() not refresh DOM. Execute this function after any DOM change.
0
1128
posted 11 years ago by goo
you can use this minified jQuery snippet to detect if your user is viewing using a mobile device.
1
1244
posted 11 years ago by goo
This is a skeleton template for a jquery plugin with custom methods
1
932
posted 11 years ago by rickygri
This can come in handy for a reset or cancel button. You can clear all inputs within a single div in one line of code. Pretty sexy.
0
946
posted 11 years ago by mattvbiggs
.on( events [, selector] [, data], handler(eventObject) )
A delegated-events approach attaches an event handler to only one element, the tbody, and the event only needs to bubble up one level (from the clicked tr to tbody):
0
874
posted 12 years ago by grindking
A very good slider / carousel. Um slider / carrossel muito bom. Ideal para designs responsivos.
0
740
posted 12 years ago by nivasgallo
This code allows Google Analytics to monitor hashtags of jQuery activated events. Very useful if you relies on modal boxes.
Este código permite ao Google Analytics monitorar hashtags e âncoras em sites com eventos ativados por jQuery. Muito út...
1
694
posted 12 years ago by nivasgallo
For some reason setting a default value for select elements does not work. This one line of jquery solves that problem. Assign a value (value="something") to the select tag that is to be the default value. With jquery get all select elements with a...
0
1464
posted 12 years ago by halk
This will monitor the status of all ajax calls on the page. When ajax starts i show an animated spinner gif and display a message that ajax has been requested. On completion of a call the status returned is displayed and the spinner is hidden to in...
1
919
posted 12 years ago by halk
If you have a list of images and want'them all to preload before page is shown. This function is very useful.
I use it in various cases working with Phonegap to get my app a better native experience.
0
808
posted 12 years ago by bernhardb
Smart Time Ago is a little jQuery library to update the relative timestamps in your document intelligently.
0
842
posted 12 years ago by praveensewak
Quite useful snippet to log all events triggering occuring in your app. Because it uses event.global array, it logs custom events as well as native ones
For developpement use only, disable it before migrating to production environement.
1
589
posted 12 years ago by mandawan
If someone put text into an input field (or automatic e.g. with a 2d barcode scanner) and you want to replace a part of the input (pattern) then will help this small jquery code snippet.
0
1198
posted 12 years ago by bassdas
obviously one can access HTML5's data attribute super easy in jQuery
0
969
posted 12 years ago by iroybot
Used to automatically give feedback on email address validity.
0
915
posted 12 years ago by boondoklife
This is some code that creates an effect for jQuery Cycle to scroll up when you click the down button and down when you click the up button - like a scrollbar.
0
960
posted 12 years ago by JoshChris
This is a pretty standard jQuery method to listen for the enter key and simply "click" the button. However, if you are using a LinkButton this code will not work. The reason for this is that a LinkButton is rendered to the browser as an Anchor tag...
0
676
posted 12 years ago by weldonr30
A complete lightbox with minimal code and full functionality: close button, close on escape keypress, close on lightbox blur event.
1
735
posted 12 years ago by mortu
Use this snippet to check if user supplied URL is a valid Youtube URL. Has support for youtu.be shortened URL's too.
1
1209
posted 12 years ago by Morg