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
Simple Javascript form validation
Here i have written JS code to validate form, for example:
checking empty fields, checking email, password user-name etc.
function valid()
{
var name = document.getElementById('name').value;
var passwd = document.getElementById('...
jquery methods: addClass toggleClass and Remove class
jQuery has Basically three methods for CSS manipulation Following methods is explained using below example:
1.addClass() - Adds one or more classes to the selected elements
2.removeClass() - Removes one o...
Underscore.Js
"Underscore.js" a tiny and powerful library with a minified size of 5.7kb. You can download this library from
http://underscorejs.org/underscore-min.js
This library support over hundred of functions which can be very useful in our...
The difference between == and === in jQuery/Javascript?
double (==) : This operator is used for checking equality, no strict comparison is done i.e this operator first converts the values to specific type then comparison is done and this conversion is done by the javascri...
How Page Re-direction Works
The implementations of Page-Redirection are as follows:
Example 1:
In Java script we can simply do page redirect at client side. if any visitors visit the website then you can redirect your website visitors to new page , For that you just n...
How to check if function exists or not in Javascript and jQuery
There might be some cases when we need to call a function without checking if function's definition is loaded or not. If loaded then that will be fine but if not loaded then it will throw an error as undefined function. We can handle this in ...
Profanity filter for multiple languages
To check the profanity in the text for multilanguage, here we use WebPurify web service. This web service provide various callable methods including check, checkcount, replace, return etc. But here we are using the replace method (webpurify.live....
To show the current date month and year using javascript
Hi,
Below code example will help you to "show the current date month and year using javascript".
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-tr...
Javascript:Exchanging data between a document in an iframe and a parent document.
Hii,
I am providing a very simple javascript code by which we can access variables and invoke functions in the parent document and vice-versa.
Please go through the given example below and understand the concept.I hope it will be...
Promises in Angularjs
Promises - AngularJS's promise provides a built-in service $q. It provide a way to execute asynchronous call in series by registering it with a promise object.
Let us now elaborate promise and deferred.
Deferred - It represent the ...
Objects in javascripts
Lets understand "Objects" in javascript.
Object: It is a collection of property and each property is associated with name value pair. The object can contain any data type.
Lets understand this with the help of an example:
var demoObj = {...
How can I do change background color of an Chekbox using css?
Hello readers...
I face a problem in changing the background color of a check-box. Please help me out from this problem.
By using background property it takes its default value as you have seen the color and text of a check- box will change to ...
How to change data on changing the option box
Hello Reader's if you are looing to develop the html form which changes the data on changing the values in option box, then in this blog you can see how it is done.
To making this form we will start from html file. And its code will go like this...
Events In Javascript
We can handle interaction of javascript with html document with the help of events that take place when user perform some task or when browser performs some manipulation on a page.
Below are some example of an events:-
Loading of page
...
Age and Email validation by using javasciprt
Lets see an illustration how we can validate age and email id through javascript
In this example,we are taking inputs from user in age(textbox) and Email (Textbox). By using functions of javascript we can validate both the values.
fu...
Data Types
In javascript,There are variables in which we can store the values. We declare a variable with the var keyword:
var myVariable;
The variables have different data types in javascript.
VariableExplanationExample
StringIt takes "A stri...
Using hasOwnProperty() method in "for...in" loop JS
We all know that for...in loop is used to iterate over enumerable properties of object as well as properties of its prototypes, but what if we want to iterate over properties attached to the object itself, and not its prototypes.
this is where...
FORM VALIDATION USING JAVASCRIPT
We can do validation of a form which is created in html by using javascript.
In below example if we do not put any thing in fname field, then validateName function will alert a message that Name field is empty.
eg:-
function validateN...
Purpose of onerror event handler in javascript
In JavaScript onerror is a Document Object Model event handler. It occurs when error occur during object loading. In JavaScript window.onerror is used as an event handler, there is no error event being triggered: Alternatively, when the exceptio...
Exception handling statement in javascript
In JavaScript try/catch/finally are called exception handling statements. In JavaScript try/catch/finally statement manage some or all of the errors that might occur in a block of code. Try/catch/finally in JavaScript lets you deal with exception...
Function parameters in javascript
We know that in JavaScript functions have parameters
function(parameter1, parameter2, parameter3) {
code to be executed
} // here function is the name of the function
Rules for the parameters
We do not specify data types fo...
Arrow functions
Arrow functions are the functions that have a shorter syntax compared to function expressions and arrow function lexically bind the this value. Arrow functions effectively turn function (arguments) { expression } into arguments => expression a...
How to validate email address
It is very important to validate the email while validating an HTML form. An email is taken as a string which is separated into two parts by the @ symbol.
1. user_info
2. a domain
i.e., user_info@domain.
The length of the user_info pa...
LOOPS IN JAVASCRIPT
LOOPS IN JAVASCRIPT
A loop allows us to repeat or execute a set of statement multipel times, which are written inside a loop. It execute a block of code many times. Just like all other programming languages javascript also support looping con...
Conditional Statements in Javascript
Conditional Statements:
Conditional Statements are those statements which run different block of codes according to the condition or we can say these are those statements which perform different actions.
Following conditional statements ar...
Exception Handling in Javascript
Exception:
An exception is an error that occurs during runtime of a program. Example can be like we are using a array index that is out of bound of defined array in a program.
Exception Handling:
Exception handling is used to handl...
Javascript predefine functions
Function in programming language can be called anywhere in a program and it can be used again and again in the entire program you have to make a function once and you can call that function whenever you want. The programmer need not write the sa...
How to replace characters in the current URL using Javascript
How to replace characters in the current URL using Javascript
During development in one of my project, I need to replace an expression in the URL, the code that helped me is as follows:-
The Steps we will follow are:
1. Get the current UR...
JAVASCRIPT OUTPUT DISPLAY FUNCTIONS
In javascript we use different functions to display outputs, like to display into an alert box, HTML output, HTML element,browser console we use different functions.
1. window.alert():- Used when we want to display data into an alert box.
E...
How to increase font size of website by just single click
Hello Readers if you want to make a switch button that will increase your font size of webpage then you can learn to code it here.
first you have to create html page name it click.html, It's code will go like this:-
<!doctype html>
...
How to make div movable using Jquery
Hello Reader's if you want to make a UI where your div can drag and movable all over the screen. Then the followin example is helful to you.
<!DOCTYPE html>
<head>
<link href="http://code.jquery.com/ui/1.10.4/themes/ui-...
How to generate date selector using in website
Hello Reader's if want to generate the date selector then you can use the Javascript. By choosing JS you don't have to write every month, day or date hard core in the code.
Lets start to generate the code for it.
Step 1: Create head section ...
How to make live clock on website uisng Javascript?
Hello readers if you want to show a live clock on your web page then you can use the javascript to make it.
So lets start with html page. Create blank HTML page name is clock.html, And it's code will go like this:-
<html>
<head>...
How to change background color by click using Javascript
Hello Reader's if you want to change css of any div or section or iframe with just a single click then javascript offers you to do this in real time.
Lets see how to change background color of an ifram using just a single click
<iframe src...
How to make simple ToDo section in javascript
Hello Reader's if you need to develop the todo section in your website where user can create the lists and mark then when they are complete. Then Javascript is the best option for you.
Lets see it's working code as below:-
The html file will ...
How to make switch between thumb and list view using Javascript
Hello Reader's if you are making the website and you want to create a switch which convert thumb view into listing and listing view in thumb view then you take the help from the code as below:-
Here is the html page and code will go like this:...
How to make auto search using Javascript
Hello Reader's if you want to make realtime search listing from text box then here you can learn how to do it.
This code is driven by Javascript. The listing will appear from another page and quick search will works on from page.
So the html co...
To get all properties that belong to an object in javascript
To get all properties that belong to an object in javascript, we can use Object.getOwnPropertyNames(). The ordering of the non-enumerable properties in the array, and among the enumerable properties, is not defined.
Example:
var arr = ['a'...
Splice method in javascript
The splice() method is used to add/remove items to/from an array, and returns the removed item(s).
Syntax
array.splice(index, howMany, [element1][, ..., elementN]);
where
index Index at which to start changing the array.
howMany ...
How to create a custom two-dimensional Array in javascript
Hello friends,
Most of time we need to create 2-D array in javascript but javascript does not provide direct syntax of multidimensional array . But we can create custom two-dimensional array in javascript.
For Example :
var myarray=new Arra...
How to show javascript timer on web page
Hello Reader's if you are developing the portal where you want to show user the coundown time. Then this blog is usefull to your. Let's see how to make an auto counter in Javascript:-
first create a html file and name it count.html and code will...
How to save data on local system using Javascript
Hello Reader's if you want to store some data on user local system so that even he turn off or refresh the webpage the data will still remains the same then you can use the Javascript for that.
Let's consider an example where you have an coun...
How to show google map on web application.
Hello Readers ,
Below are the simple steps to follow to show the google map.
Add the Goggle API
<!DOCTYPE html>
<html>
<script src="https://maps.googleapis.com/maps/api/js"></script>
<body>
<h1>M...
AngularJS Basic, Value, Service, Factory & Provider Example and description
Hi Readers,
I recently got my attention to new JavaScript framework that is AngularJS. I read lots of articles about it but I usually do not understand anything just by reading about it. I am more about the practical person and can not actuall...
How to declare Array variables
Hello Reader's. Array is a datastructure used to storing multiple elements inside it. But the declaring way to array is different in all the technologies.
For example if you want to declare array in JavaScript then you can use any one out of t...
token-input Drop Down Overlapping issue in Popup
"Token-input" plugin has an issue with it. That is the drop down <div> which is added dynamically to the body it do not work properly if the input box on which tokenInput is bind to is in the popup. As the drop down is created some where ou...
Ckeditor in Android and Iphone
Hi All,
Recently I faced a problem with the Ckeditor not working on the Android and iPhone. After a great R&D I came to know there is an issue with the Ckeeditor and due to some security issue it has disabled its functionality from working...
Multiple Highcharts on a single webpage
Hi All,
In my latest project I needed to implement multiple Highcharts on a single webpage and to accomplish that I used the following approach.
The main objective of this blog is to cover three things:-
Multiple Highcharts on a single ...
How to make iconic hower on link using Javascript
Hello Reader if you want to make the nice and iconic hower on link then you can use Javascript as below:-
<!DOCTYPE html>
<html lang="en">
<body>
<div class="container">
<h3>Tooltip Example</h3>
...
How to show max words left to insert into text area
Hello Reader's if you are making the html5 validation to set the max words inside the html form, Then by using Angular JS NG-Model you can easily make it.
Lets's see how to do it as in the example below:-
<!DOCTYPE html>
<html>
...