Featured
-
Top 10 Template Engines for JavaScript
What is a Template engine? Template Engines are
by nishant.mishra -
jQuery Accordion
Hello readers! In this Blog we will gain knowled
by vishwanath.rana -
How to make Numbered and bulleted list in HTML Editor with JavaScript
Hello all, Working with HTML Editor we wanted t
by gaurav.gautam -
How to hide particular div with just one click?
Hi, you want a condition in which the particula
by abhishek.tiwari.458 -
How to Create and Retrieve Array in Javascript?
If you want to store multiple values in a single v
by siddharth.shahi
Tags
How to get month name from given date using Javascript
Hello Reader's! On a date given like (03/25/2014) if you want to get the month name from it then by using JS you can do this as follow:-
var objDate = new Date("12/12/2009"),
locale = "en-us",
month = objDate.toLocaleString(locale, { mo...
How to block enter button for submitting the form using Javascript
Hello Reader! If you want your html form that block the pressing action of enter button and accept only submit button then you can see how its working in the example below :-
$("FormSubmit").bind("keypress", function (e) {
if (e.keyCode =...
Javascript events in HTML
HTML events happen to HTML codes. When we add Javascript in HTML pages, Javascript then react to those HTML pages.HTML event does by the browser or a user.
Some common HTML events are -->>
Here is a list of some common HTML events:
1...
How "this" keyword works in Javascript
The code example of this keyword in Javascript
var fullname = 'David';
var obj = {
fullname: 'john mars',
prop: {
fullname: 'Brett',
getFullname: function() {
return this.fullname;
...
Finding mouse cordinate by JQuery
By using jquery event.pageX and event.pageY we find the coordinate of mouse. The PageX event shows the edges from left and the PageY event shows the edges from top.
<!doctype html>
<html lang="en">
<head>
<meta cha...
How to convert Unix timestamp to time using Javascript
Hello Reader! If you having the timestamp generated by Unix and you want it to be in format of time then you can use the example code below:-
function MakeTime(TimeUnix) {
var d = new Date(TimeUnix);
var h = (d.getHours().toString(...
How to load a html page inside another web page using Javascript
If you have two html pages and you need to load one inside of another then using Javascript you can easily perform this action by 'load' syntax:
Lets consider two pages one.html and second.html
one.html will go like this
<html>
&...
How to take inputs as only digits using Angular JS
Hello Reader!
If you are designing a html form and wants to make it validate for accepting only digits as input then you can see the code below for the same:-
You can create the html form like this way:-
Validate Price
...
Example of ng show / ng hide in Angular JS
If you learning the Angular JS and use a parameter from an object as the expression then the ng-hide and ng-show are given the correct true/false but always remember these true/false is not like boolean so always return false:
Consider the examp...
How to make add item list using Angular JS
If you want to make a functionality of manually adding items to the list using Angular JS. Then you can use the following code of Angular JS it will work on client side and performs fast.
For the form the HTML will go like this:-
<div n...
How to find a string inside another string using Javascript
Suppose you have two strings and you need if they contains same words. Then in this case you have to use 'strName.indexOf' function.
Let's consider the example below:-
var MyString= "I'm explaining string match on findnerd portral";
var F...
How to generate random number using Javascript
In Javascript you have a number of functions to genrate random numbers between two given digits. Some of them are inbulit and some you can create for your own, But the simplest way to perform the operation is the code below:-
// Returns a rand...
How to use different versions of Jquery on a single page
If you calling the different versions of Jquery then your code can clash the mutual variables.
To use each of the Jquery versions separately you have to use " jQuery.noConflict()"
Consider the links with multiple Jquery versions below:-
&l...
How to compare two dates using Javascript
On using the javascript technology you can perform the comparison operation very quick in real time.
In this case we will see how to compare two given date:-
var DateOne = "1991-10-10".split('-');
var DateTwo = "2005-09-01".split('-');
v...
How to sort an given array using Javascript
Hello Reader!. If you dealing with a array full of unsorted keys then you can use some of the syntax to sort them in any order, Consider the cases below:-
var MyArray = [
{ Entry: { Fname: 'Micky', Lname: 'Jones' }, CustomerID: 56563 },
...
How to resize the iframe for any content load
iframe are fixed of length but you can still make it dynamic in height and width, the logic behind this is to pass message from your html frame to the new class helper html window.
And by using the src ="" with given through the url.
And the...
How to redirect a Web Page via Javascript
First question is that it is legitimate to use JavaScript redirect over other available options like Htaccess Redirect, html Redirect, Php redirect etc. as SEO point of view ?
The answers is famous quote from Google Support itself.
"Usin...
Javascript The toFixed() Method
Basically toFixed ( ) method is used to cut a number after the decimal upto certain point . Suppose i have a number **i.e 12.345678** and i want this number **upto 2 decimal** places only , then using toFixed method i can cut the number afte...
JavaScript Object Properties
Properties are defined as the values that are associated with a JavaScript object.It is also called the very important part of Javascript.
A JavaScript object is made up of a collection of un-ordered properties.It can be changes, added, deleted....
HTML Event Attributes
Let us discuss some of the HTML Events Attributes:
1. oninput
2. onselect
3. onchange
4. onsubmit
5. onkeypress
6. onresize
Let us discuss it one by one
1. oninput - When an element get the user input, this attribute fires autom...
Splitting a String in javascript
To split a string in javascript, we use split() method which splits the string into an array of substrings.
Syntax: string.split(separator);
Where separator specifies the character(s) to use for separating the string, and if this separat...
Do While Loop in Javascript
Do While loop Executes a statement once, and then it repeats the execution of the loop until a condition expression becomes false.
The do while loop consist-
do {
statement
}
while (expression) ;
statement--> The statement t...
How confirm and match the password fields on a html form
Hello Reader!, If you looking for a front end validation for matching the two passwords feilds with Javascript
then you can see how to get it done.
Lets consider the example below
Here i'm using the html code for the form
<form clas...
How to make Fancy Box on your text portion
Hello reader! if you having the page and need to show the fancy loading on any text portion then you can see the code below.
For the loader and the text the css will go like this
#dummy {
display: none;
}
#target {
display:inl...
How to improve performance of a AngularJS app
Hello readers if you using a long Angular JS app and want to make it's performance better you can see here how to make your app efficient
There are two ways of achieving this for a developer namely 1. disabling debug data and 2. enabling stric...
Difference between 'null' and 'undefined'
The difference between undefined and null is as follows,
1-When we declare any variable and we do not give it a value then it will have the value undefined.Undefined is a type all to itself
2- We can declare a variable and can set it to n...
Operator in Javascript
There are following types of operators in JavaScript.
1- Arithmetic Operators ( +,-,*,/,%,++,-- )
<script>
var a= 1;
var b = 2;
var c = a + b;
document.getElementById("demo").innerHTML = c;
</script>
2- Comparison (Rel...
Javascript getDay() method
JavaScript getDay() Method
Return the day of the week:
var d = new Date();
var n = d.getDay();
This method is used for getting the days of week from 0-6 for the date specified.
in this 0 stand for sunday and 1 stand for monday.
Synt...
Javascript and If Else statement
If else statement like any other computer language are used for condition. If the condition satisfies it goes for first statement and if it does not than it goes for the second statement.
1.if is use to run a code if a condition is true.
2.el...
Javascript Datatype
Javascript data type can hold may data type like number string arrays object and other.
To declare a variable we use var keyword
example
var length = 16; // Number
var lastName = "Johnson"; ...
Javascript Comments
Javascript Comments
Comments like in any other computer language are used for making the code understandable ie explaining the code in simple language.
They are not executed by the javascript.
There are two ways to enter the comments
1. Sin...
How to Change the Number of Records show 10 entries of jQuery Datatable
Hi,
In this short tutorial I have given an example to change the number of records “show 10 entries” of jquery datatable.
If you are using the DataTable then by default it will show the records for 10,25,50 ...
Reference-counting garbage collection in Javascript
In Javascript, when we define any variable(string, object, integer, function etc..), some memory is allocated with it and freed when they are not in use by garbage collector and this process is called garbage collection. This whole process we can...
How to use custom filters in our code in AngularJS
Filter is one of the important part in angularJS. There are many default filters like:
1. uppercase
2. lowercase
3. orderby
etc.
We can use these filter simply by adding a pipe character (|) in the expression.
Now we will discuss a custom ...
How to create deleteCookie() function in JavaScript
With the help of javascript, I have created deleteCookie() function. In the code given below, I have stored all the values in a single cookie and then used deleteCookie() function for deleting the cookie. When the cookie session expires, previous...
How to create conditional display using AngularJS
With the help of AngularJS, I have created a conditional display function. In the example given below, I have used ng-show( for showing the element ) and ng-hide( similar to 'display:none' or hide the element ) derivatives.
HTML-
<!DO...
How to create dynamic checkbox using JavaScript
With the help of JavaScript, I have created a dynamic checkbox function. When i will click on create button it will dynamically create a checkbox item list and by clicking on checkbox item it will be removed easily.
<html>
<head>
...
How to Add and Remove items in array using AngularJS
With the help of Angularjs, We can dynamically add or remove list items in an array. It is shown In the example given below.
Addition of the list items is done using 'push' method and removal of the item is done...
How to set Cookie() function in JavaScript.
With the help of javascript i have created set Cookie() function. In the below code I have store all the values in the single cookie. By using this function many cookies will store at a time.
<script type="text/javascript">
var today ...
How to create JavaScript confirm Model
In the code given below, i have created a javaScript Confirm Model with the help of bootstrap. I also used document ready event handler to trigger the event.Confirm model without a callback isn't particularly useful,but it is entirely possible ...
Jquery Return false, event.preventdefault and event.stopPropagation
Return False :-
Basically returning false is a way to tell your action (like button click event, submit and load etc. ) is not firing. Return false do the three basic things
event.preventDefault();
event.stopPropagation();
Stops the call...
How to Dynamically add element in DropDownList?
I have created a dropdownlist with the help of Jquery and javascript. In this, when we will enter the text in the field given, that value will be stored and will be added to the next list dynamically. Also We can easily remove all the items by ju...
How to use loading and saving data from the local storage
In below code, I have used a constructor shoppingCart for the parameter CartName which identifies the Cart while loading data from the local storage. I have also used clearItems() function which is used to clear the cart and saveItems which is u...
How to create window.prompt Method
With the help of this javascript prompt() function, I have created a dialog box that will be used for taking user input. The prompt() method displays a dialog box that prompts the user to input data
<!DOCTYPE html>
<html>
<h...
How to use Animated AJAX Record deletion in jQuery?
With the help of jQuery we can delete link for any record. On below code we have add a click event to triggers the ajax request. when the ajax request returns get success response.
$(document).ready(function() {
$('a.delete').click(fu...
How to show multiple items in a textbox, using auto completion in Javascript
"How to show multiple items in a textbox, using auto completion in Javascript"
In this article we will make a project that will select multiple items from the autocomplete list and display them in the textbox as tags using Javascript.
For ...
Prototypical inheritance in javascript
prototypical inheritance... We have used many different types of inhertance which are based on classes but today we are going to discuss the prototypical inheritance in javascript. It is based on objects, you can simply inherit one object to othe...
script for copy to clipboard
Copy to clipboard.. You can see this option in most of the blogs. You can simply click on the link and it will copy the text which set as target. Today we are going to discuss the implementation of this feature. We can see different ways to do th...
How to create Generated Keyframes in Javascript
Hello friends, I am sharing a generated keyframe with you . In this code I have set an animation on a DOM element . I have used insertRule for dynamically adding CSS and <style> tags for making it easier to remove the animation once the...
How to Create Real Time Changing Clock
With the help of javascript we can create changing clock time function. In the example given below I am using setTimeout function (changed other value) when clock refresh it will show the exact time once in every seconds.
<html>
<hea...