Simple Form validation jQuery snippet

There are plenty of powerful jQuery validation plugins out there to meet your needs, but sometimes your requirement is so little that you just don’t bother including these plugins into your page, you might just create your own simple validation for your Form. So here’s a simple jQuery validation script you can include in your form page and have almost powerful validation.

Image Preview (Thumbnails) before uploading – jQuery

If you are creating an image uploader, you can provide thumbnail preview of currently selected images in file input field. We don’t need to upload entire file to server to do that. File API is supported by all modern browsers, we just need to take advantage of this feature, it provides us with information about files and allows to access their content.

Select All Text In Element on Click (JavaScript OR jQuery)

To select all text inside an element such as DIV, we can simply use JavaScript document.createRange() method to create a range, and than using range.selectNodeContents() we can set node range (start and end), after which use selection.addRange() to select the range of the element.

Play MP3, Ogg, Wav files with HTML5

With HTML5 we can play audio files easily, but before HTML5, we could only play these files using Flash player or Media Player plugins. Old browsers didn’t have inbuilt media player that could perform these tasks. But HTML5 we don’t need anything, just regular <audio> HTML element.