JSFiddle

  • File Upload Only Button #2 is the latest revision

    text overflow with ...

    $('#button').click(function () {
        $("input[type='file']").trigger('click');
    })
    
    $("input[type='file']").change(function () {
        $('#val').text(this.value.replace(/C:\\fakepath ...
  • remove all child nodes of a div

    jQuery 3.0.0, HTML, CSS, JavaScript

    $( "button" ).click(function() {
      $("#container").empty();
    });
  • numeric only textfield

    jQuery 2.2.4, HTML, CSS, JavaScript

    $("#txtNumeric")
       .on('keydown', function(e) {
       		/*if(!(event.keyCode >= 48 && event.keyCode <= 57) || (event.keyCode >= 96 && event.keyCode <= 105)) {
          		event.preventDefault();
          }*/
          
          
          if ($.inArray(e.keyCode, [46, 8, 9, 27, 13, 110]) !== -1 ...
  • 2 ways to refine from a model

    or to load directly

    filteredResults: function() {
        var filter = this.get('filter');
        return this.get('model');
        /*return this.get('model').filter(function(item) {
          return item ...
  • filter come reload model

    No-Library (pure JS), HTML, CSS, JavaScript

    3. templates: index.hbs
    <pre>
    <div class="jumbo">
      <div class="right tomster"></div>
      <h2>Welcome!</h2>
      <p>
        We hope you find exactly what you're looking for in a place to stay ...</p></div></pre>
  • rest endpoint for search/filtering #4 is the latest revision

    search/filter

    /*jshint node:true*/
    module.exports = function(app) {
      var express = require('express');
      var dealsRouter = express.Router();
      var rentals = [
          {
            type: 'rentals',
            id ...
  • mock in ember project

    No-Library (pure JS), HTML, CSS, JavaScript

    <h3>1. genarate ember project with ember-cli</h3>
    <h3>2. it comes with expressjs (hhtp-mock); run </h3>
    <pre>ember g http-mock destinations</pre>
    <h3>3. to view ...</h3>
  • JSON from JS Object

    building blocks - plain javascript object notation

    var obj = { name:"Neezmah", age:18, city:"Melbourne"};
    var myJSON = JSON.stringify(obj);
    console.log(myJSON);
    document.getElementById("demo").innerHTML ...
  • percentage 5 decimals

    jQuery 2.2.1, HTML, CSS, JavaScript

    $(document).ready(function() {
    	$('input#decimal').blur(function() {
      	var tailoredNum = parseFloat($(this).val());
        if(!$(this).val()) {
        	return;
        }
    
    		if(parseFloat($(this).val ...
  • find duplicates #2 is the latest revision

    using jquery

    var names = ["Mike","Matt","Matt","Adam","Jenny","Nancy","Carl"];
    var uniqueNames = [];
    var counter = 0;
    $.each(names, function(i, el) {
        if ...