Category Archives: Javascript

Adding an Infinite Nested Hierarchy of Observable Objects Using Knockout from .NET Core / MVC

Sometimes you may come across a situation where your JSON is representing a hierarchy of objects, which you then would like to show on a page. One of the common ways to do that is nested div‘s but, of course, … Read More »»»

Posted in Knockout | Tagged , , , , , , , , | Leave a comment

How To Change A Bootstrap Popover Title And Content Dynamically

Typically, when creating a bootstrap popover, you would declare, initialize and call it like this: Do Something $(function() { $(‘[data-toggle=”popover”]’)({ trigger: ‘manual’, placement: ‘auto top’, delay: { show: 500, hide: 500 } }); }); function doSomething() { $(‘#do-something-popover’).popover(‘show’); } However, … Read More »»»

Posted in Bootstrap | Tagged , , , , , , , , , | Leave a comment

Creating A Phone Number Input Control With Javascript

In this article I am going to show you how to create a cool phone number control in HTML using Javascript. Surely you have seen forms where you are asked to enter a phone number in three boxes – one … Read More »»»

Posted in Javascript | Tagged , , , , , , , , , , | Leave a comment

How to Allow Only Numbers in HTML TextBox Using Javascript

Sometimes you want to constrain what a user can enter in a textbox input on a page. This article shows you an easy way to do it with javascript and explains how it works. In short, you want to trap … Read More »»»

Posted in Javascript | Tagged , , , , , , , , , | 1 Comment

How to Determine If Caps Lock is On With Javascript

A nice nifty feature you can add to your web login page or maybe somewhere where entering information is case-sensitive is to hint the user if the Caps Lock key is on. While there is no way to capture the … Read More »»»

Posted in Javascript | Tagged , , , , , | Leave a comment

How to Pass a Variable Number of Parameters to a Javascript Function

Ever came across a situation when you want to pass multiple parameters to a Javascript function but you do not know how many of those there are? For example, maybe you have an HTML page with a table that is … Read More »»»

Posted in Javascript | Tagged , , , , | Leave a comment

How to Use Optional Parameters in Functions in Javascript

Sometimes you would want to have an optional parameter with a default value when you call a function. How do you do that? It’s quite simple. Javascript does not validate whether the parameters that are declared on the function are … Read More »»»

Posted in Javascript | Tagged , , , , | Leave a comment

An AJAX GET Request

Well, a fairly old theme. But, that does not mean that everyone knows it. Here’s a bit of some code and a short explanation of how it works. If short is not for you, post a comment and I’ll be … Read More »»»

Posted in AJAX | Tagged , , , , | Leave a comment

How to Trim() a String

Sometimes we all wonder: how is it that such a widespread language as javascript does not already have a built-in function like trim()?! Weird, yes. Easy, yes, too. In fact, you can simply extend the String object with any number … Read More »»»

Posted in Javascript | Tagged , , , , , , | Leave a comment