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 .

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…

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…

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…

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…

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…