Tag: Javascript
How to redirect a page using jQuery ?
If you want to redirect a page , one of the best option is to use the window.location.replace method that can demonstrate the HTTP redirect instead of any jQuery trick. How to redirect a page using jQuery ? Below is a sample code snippet demonstrating the redirection of a page .
Getting the User’s Last Name in Windows 10 Apps using JavaScript
Below is a sample JavaScript code snippet demonstrating how to get the user’s last Name from the Windows 10 Universal Windows Platform App using WinJS. How to Get the User’s last Name in Windows 10 Apps using JavaScript ?
Adding a WinJS control in JavaScript code in Windows 10 App
You can add the WinJS control to the page in the markup page or from your javascript code. How to add a WinJS control in your JavaScript code for Windows 10 Apps ? Add the element in the markup (HTML page) that will host your control. <div id=”element”></div> In your JavaScript code , retreive the element using the document.getElementById method. var containerElement = document.getElementById(“element”); You…
How to Convert Decimal number to hex in JavaScript?
Below is a sample soucrecode snippet demonstrating the conversion of decimal number to hexadecimal in JavaScript. How to Convert Decimal number to hex in JavaScript?
Developing Windows Phone 8 app using Web technologies like HTML5, CSS3 and JavaScript
Most of the time, the developers would want to use their existing skills and develop more apps targeting different and multiple platforms. For example, the Web developers might want to develop Windows phone apps using HTML, CSS, Java Script and other Web technologies that they know. Can the Windows Phone 8 app be developed using Web technologies like HTML5, CSS3 and JavaScript? Yes, the Web…
How to Validate Email Address in JavaScript ?
Here’s a sample JavaScript function that shows how to validate an email address . How to Validate Email Address in JavaScript ?
Searching in an Array in JavaScript
If you want to search an array for a value in JavaScript and retrieve the index of the found array element , you can use the Array’s indexOf method. How to search for an element in an array in JavaScript ? When using the indexOf method , if the value is found, it returns the index representing the array element. If the value is not…
How to Clone an Object in JQuery ?
If you are looking at cloning an object in JQuery , you can do that using the jQuery’s extend method . You can perform the shallow copy or deep copy by setting the parameters. Below is a sample code snippet demonstrating how to clone an object in JQuery How to Clone an Object in JQuery ? The above method performs the shallow copy . You…
Getting the User First Name in Windows 10 Apps using JavaScript
Below is a sample JavaScript code snippet demonstrating how to get the user’s first Name from the Windows 10 Universal Windows Platform App using WinJS. How to Get the User’s first Name in Windows 10 Apps using JavaScript ?
How to Create a Class in Javascript in WinJS ?
You can define a new class using WinJS.class.define when developing Windows Store App using Javascript. How to Create a Class in Javascript in WinJS ? The WinJS.Class.define method can be used to create a new class in WinJS . It accepts 3 parameters – Constructor – instanceMembers – staticMembers Below is a sample code snippet demonstrating the usage WinJS.Class.define to create a new class in…
JavaScript Libraries and Frameworks
Below are links to some of the JavaScript Libraries and Frameworks Bindows EXT.NET Qooxdoo sproutcore Yahoo User Interface Library Rialto jQuery UI vaadin Ample SDK Cappuccino DojoToolkit
What is the Difference between window.location.href and top.location.href in JavaScript?
Sometimes, you might be using the JavaScript to get the current location of the page. You might come across 2 properties window.location.href top.location.href What is the Difference between window.location.href and top.location.href in JavaScript? The window.location.href will return the location of the current page. The top.location.href will return the location of the topmost window in the heirarchy. This can be generally be useful when using the…
How to Auto Refresh page every 5 seconds using JavaScript?
Below is a sample code demonstrating how to refresh the page automatically every 5 seconds using JavaScript. How to Auto Refresh page every 5 seconds using JavaScript?
How to find all instances of a pattern in JavaScript ?
To find out out all the instances of a pattern in JavaScript , you can use the regular expression as showb below. How to find all instances of a pattern in JavaScript ?
How to Check if all elements in array are alphabets in JavaScript ?
JavaScript provides the every() method defined in the Array object which lets the developers to check and validate the contents of the array in JavaScript. How to Check if all elements in array are alphabets in JavaScript ? Below is a sample code snippet demonstrating the usage of the every() method to find out if all the elements in the array are alphabets. Note that…
How to clear the array in JavaScript?
There are times when you want to clear the array that you have already defined with entries and reuse it. For example Arry = [109,625,200]; How to clear the array in JavaScript? One of the easiest way to clear the array contents in JavaScript is setting the Array Length t0 0.
Templates for developing Windows 8 App using Javascript
The Windows 8 SDK provides the following templates for developing Windows 8 (Metro/Modern UI) apps using JavaScript . Blank App Grid App Split App Fixed Layout App Navigation App
JavaScript Unit Testing tools
There are plenty of Unit testing tools available which lets the developers to test their JavaScript code easily. In this article , we cover few of the popular JavaScript testing tools. JavaScript Unit Testing tools Karma Karma has the tagline “Spectacular Test Runner for JavaScript”. Karma is a very simple JavaScript Unit Testing tool which is built with node.JS. Karma lets the developers to run…
Creating Namespace in WinJS for Windows Store App ?
When developing Windows Store App using WinJS library , there are times when you want to create a namespace . You can use the WinJS.Namespace.define() method to create a namespace. Below is a sample code snippet demonstrating how to create a namespace in WinJS for Windows Store App using WinJS. Creating Namespace in WinJS for Windows Store App ?
How to pass a function as parameter in JavaScript ?
There are times when you might want to pass a function as argument to another function in JavaScript. The function keyword can work in multiple ways. It can act as a operator and a statement as well. Additionally , you can create an expression as well. How to pass a function as parameter in JavaScript ? We can pass a function as a parameter to…