jQuery Checkboxes: Select All, Select None, and Invert Selection

A demonstration of selecting checkboxes using jQuery.We start off with a bunch of checkboxes: [sourcecode language=”html”]<input type="checkbox" name="numbers[]" value="0" /> <input type="checkbox" name="numbers[]" value="1" /> <input type="checkbox" name="numbers[]" value="2" /> <input type="checkbox" name="numbers[]" value="3" /> <input type="checkbox" name="numbers[]" value="4" /> <input type="checkbox" name="numbers[]" value="5" /> <input type="checkbox" name="numbers[]" value="6" /> <input type="checkbox" name="numbers[]" value="7" /> … [Read more…]

Random password generator with JavaScript

In JavaScript To generate password use the following function. function generatePW() { var i=0; var s=”abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_?/:(){}[]0123456789″; var pw=””; var c=(Math.random() * 3)+9; for (i=0; i<c; i++) { pw+=s.charAt(Math.random() * 72); } return(pw);} Here the JavaScript function Math.random() generates a random number from 0 to 1 (actually just less than 1). So the code: var c=(Math.random() … [Read more…]

How to make jQuery work on the same page with Mootools and or Prototype?

Recently i have faced thats problem on my project. Several of my pages use both JQuery and Protoype. Also i have used Mootools some pages. JQuery this appears to be causing problems, because both libraries define a function named ‘$’. JQuery provides a function noConflict() which relinquishes control of $ to other libraries that may … [Read more…]