JSFiddle

  • Animate changing the src-attribute of img-tag

    Someone asked me if you could animate changing the src-attribute on the img-tag. I gave him t his.

    function changeSrc(src, time) {
        time = time || 500;
        var $src = $('.src');
        function less() {
            var txt = $src.text();
            if(txt.length > 0 ...
  • Turn form input fields into name/value pairs

    Just a quick example to see what I come up with given little time.

    var form = document.getElementById("form");
    
    function collectElements(form) {
       // Fetch the interesting elements
       var input = form.getElementsByTagName('input');
       var text = form ...