JSFiddle

  • Restrict INPUT characters #5 is the latest revision

    jQuery 1.10.1, HTML, CSS, JavaScript

    $('input').bind('input', function() {
      var cursorPos = this.selectionStart,
          r = /[^a-z0-9]/gi,
          v = $(this).val();
      if(r.test(v)) {
        $(this).val ...
  • Clear <input> via icon #4 is the latest revision

    Clear an <input> element via an icon that appears to be contained within the element

    $('.input-clear-icon').hide();
    
    $(document).on('keyup', 'input.with-clear-icon', function() {
        if($(this).val().length > 0) {
            $(this).next().fadeIn(300);
        }
        else {
            $(this).next ...
  • Find <a> nearest mouse

    Find the <a> tag that is closest to the current position of the mouse

    (function() {
    
        var nearestLinkDisplay = document.getElementById('nearestLinkSpan'),
            linkElements = document.getElementById('links').getElementsByTagName('a'),
            i, ii,
            linkBounds = {};
        
        function getMouseCoords(e) {
            var x ...
  • Calc Distance Between Mouse and Element

    Determine the distance between the mouse cursor and a <div> element

    (function() {
    
        function getMouseCoords(e) {
            var x, y;
            e = e || window.e;
    
            if(e.pageX || e.pageY) {
                x = e.pageX;
                y ...
  • Gregorian

    Find milliseconds from start of Gregorian calendar (1582-10-15) to today

    var a = new Date(),
        c = Date.UTC(1582, 9, 15),
        e = -c + a.getTime(),
        debug = document.getElementById('debug');
    
    debug.innerHTML ...
  • UUID #34 is the latest revision

    Aiming for strict RFC compliance with support for UUID versions 1, 3,4, and 5.

    if (typeof UUID === "undefined" || !UUID) {
    (function(){
        var UUID = window.UUID = (function() {
            var _hash = function(version, hash) {
                return hash.substr(0 ...
  • Testing transparent PNG resize #5 is the latest revision

    Before the image is returned to its original size, there is a slight, undesirable pause

    (function($){
    
        // Before the image is returned to its original size, there is a slight, undesirable pause
    
        $('#turn_object').resizable({
            minHeight: '50px ...