Category: JavaScript

  • Knockout isdirty custom data binding

    This is probably one of my favorite data bindings for Knockout.js: isdirty. The concept behind the function is to track when there is a change to any object including any of its properties. It’s extremely powerful handling nested objects as well.

    Let’s take a look at how to use:

    (more…)

  • Uncaught ReferenceError: require is not defined

    When you’re first starting out with Node js, it might be a bit confusing because you are most likely accustomed to writing JavaScript code for the web browser. When Node js is the server, the syntax is similar but there are a few differences around how other JavaScript files and modules are included. When writing on the server side you may include files as follows: require(‘./mysharedfile’);.

    (more…)

  • jQuery Datepicker with a Knockout js custom data binding

    Whether you are using the Bootstrap datepicker with a JavaScript array or the jQuery datepicker, they both use the same underlying JavaScript library. So with today’s example, let’s explore implementing the jQuery library with an added bonus of creating a Knockout.js custom binding.

    The end goal of this custom data bind jQuery tutorial is to create a form input field data bound not to the standard value binding, but instead to the custom one appropriately named: datepicker.

    (more…)

  • Full screen/background video from YouTube using jQuery

    I was searching the web for some neat ideas and I came across this intriguing jQuery plugin that allows you to embed a YouTube video on your website. No, not the standard player, but instead the video is your background. Similar to how you would use an image or color, the YouTube video plays automatically in full screen as the background of your website; here is a demo of the plugin.

    (more…)

  • Custom Knockout js binding to confirm before variable change

    Having a user confirm a selection is a very common occurrence when an action is performed. In this Knockout js tutorial I’m going to demonstrate how to ask the user to confirm their choice. Only when the user has clicked OK will the observable value be changed. This example will leverage the ko.extender to create a custom Knockout extender.

    Custom Knockout JS Extender

    (more…)