Search in my fiddles

Run the following demo

Demo

Give your fiddle userName in following function


searchFiddles.initialize({username:"shiyam"});

Search in your fiddles Easily….. 🙂

Advertisements

Download Html Using Js

function SaveToDisk(fileURL, fileName) {
    // for non-IE
    if (!window.ActiveXObject) {
        var save = document.createElement('a');
        save.href = fileURL;
        save.target = '_blank';
        save.download = fileName || 'unknown';

        var event = document.createEvent('Event');
        event.initEvent('click', true, true);
        save.dispatchEvent(event);
        (window.URL || window.webkitURL).revokeObjectURL(save.href);
    }

    // for IE
    else if ( !! window.ActiveXObject && document.execCommand)     {
        var _window = window.open(fileURL, '_blank');
        _window.document.close();
        _window.document.execCommand('SaveAs', true, fileName || fileURL)
        _window.close();
    }
}

Demo

Javascript Search in OBJECTS

For searching word through out the object


function searchInObj(objects, toSearch){
  var results = [];
  for(var i=0; i<objects.length; i++) {
    for(key in objects[i]) {
      if((objects[i][key]).toUpperCase().indexOf(toSearch)!=-1) {
        results.push(objects[i]);
      }
    }
  }
  return results;
}

For searching word in property of the object


function searchInObjProp(objects, prop, toSearch){
  var results = [];
  for(var i=0; i<objects.length; i++) {
    if((objects[i][prop]).toUpperCase().indexOf(toSearch)!=-1) {
      results.push(objects[i]);
    }
  }
  return results;
}

DEMO

JavaScript Auto Expand Textarea

HTML


<textarea id="txtarea" class="myclass">SamZ</textarea>

JS

function expandTextarea(id) {
var $element = $('.myclass').get(0);

$element.addEventListener('keyup', function() {
this.style.overflow = 'hidden';
this.style.height = 0;
this.style.height = this.scrollHeight + 'px';
}, false);
}
expandTextarea('txtarea');

JSFiddle Link