Home » JavaScript (page 20)

JavaScript

Javascript Table Example

Tables are one of the things that we use extensively in our everyday life for a number of reasons. They are easy to understand and help us manipulate our data by putting everything into rows and columns. If you’re keen on notebooks, you just draw the tables in them. If you want them on your website? You code them in, ...

Read More »

Seriate: The Glue Between SQL Server and Node.js

An example Node.js application which connects to a SQL server and serves up data via HTTP endpoints. Before leaving my last client, I was asked if it was possible for Node.js to connect to Microsoft’s SQL Server. The reasoning behind this was that the company wanted to move away from a pure Microsoft stack because of the cost and try ...

Read More »

Javascript Textbox Example

However convenient, forms have been a nightmare for developers for a long time, because they had a very important and difficult requirement to fulfill: transferring data from the client to the server. When Javascript came to be a regular in the playground, there was one ability which made it completely establish itself: the ability to completely sidestep this “drawback” of ...

Read More »

Javascript Onclick Example

The aim of this example is to show you how to handle the onclick event. A JavaScript can be executed when an event occurs, like when a user clicks on an HTML element. To execute code when a user clicks on an element, we can add JavaScript code to an HTML onclick event attribute . The onclick event fires on ...

Read More »

jQuery Select Option Example

The aim of this example is to explain and use various jQuery selectors and methods related to manipulation the select dropdown element of HTML. The <select> element is used to create a drop-down list. The <option> tags inside the element define the available options in the list. These basic HTML elements are the ones we’ll apply special selector and/or methods ...

Read More »

Promises in AngularJS. Part II. $q service.

I have already blogged about Promises in AngularJS 1.x. This is the second part which describes the Angular’s $q service. The $q service can be used in two different ways. The first way mimics the Q library for creating and composing asynchronous promises in JavaScript. The second way mimics the ECMAScript 2015 (ES6) style. Let’s begin with the first way. ...

Read More »

Javascript Textarea Example

If you have applied somewhere online, or asked for a particular thing using the contact forms of the websites, you will most probably have seen those use a text-area field for the argumentation. It is a highly convenient feature of Javascript, and if you now want to add it to your own website, I would completely agree. But how can ...

Read More »

Writing unit tests for Sails.js app using mocha

Sails.js is a wonderful node.js framework. Writing unit tests for Sails.js using mocha is pretty easy. On the before method of a mocha test you have to lift the sails application and on the after function you have to lower it. var Sails = require('sails'); describe('SailsMochaTest',function() { before(function(done) { this.timeout(50000); Sails.lift({}, function(err,server) { if(err) { done(err); } else { done(err,sails); ...

Read More »