Featured
-
How Regression Testing Detects Integral Errors In Business Processes
Humans are forever changing and evolving and so to
by kristina.rigina -
Get Display Banner Advertising Opportunity on FindNerd Platform
“Do you have a product or service that nee
by manoj.rawat -
Android O Released with Top 7 New Features for App Developers
Android was founded by Andy Rubin, Rich Miner, Nic
by sudhanshu.tripathi -
Top 5 Features That Make Laravel the Best PHP Framework for Development
Laravel is a free open source Web Framework of PHP
by abhishek.tiwari.458 -
Objective C or Swift - Which Technology to Learn for iOS Development?
Swift programming language is completely based on
by siddharth.sindhi
Tags
Circular graphs in SVG
Hello,
Here I am sharing some information related to circular graphs using Javascript.
JavaScript provides a library that generates circular graphs in SVG.
We need to include circles.js or circles.min.js file in the HTML file. It can be do...
How to validate file extension and size before upload?
Here is the example to validate the file extension and size before upload. Regular expression has been used to validate the file extension. And to validate file size, we use size property of file input i.e., img.files[0].size. Onclick event of bu...
How to detect if user click inside and outside of an Iframe
Hello Reader's! If you are developing the contents with Iframe window and you want make it show the click inside and outside the iframe, Then you can use the code below:-
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
&...
How to show loading icon while page is loading
Hello Reader's, If your webpage is taking too long to take data from database and you want to fix a loading icon for the time then you can use the following Javascript based code for that:-
First Step:-
Write the following code just after yo...
How to convert Javascript object into array
Let's see the example below:-
We have a numb as JS object
var numb = {
1: [22, 33, 44],
2: [11, 99, 66]
};
var DefineArray = $.map(numb, function(value, index) {
return [value];
});
console.log(DefineArray);
Ou...
How to load header and footer using Javascript
Hello Reader's. If you have developed the header and footer of the website separatly then it's very easy to make them render on a webpage. By using the JS you can call them with a single line of code as written below:-
<html>
<head&g...
How to detect the arrow key on press using Javascript
Hello reader's! If you are making the website based on user press key events. Then to detect the arrow key pressed by user we can code as below:-
document.onkeydown = function(e) {
switch (e.keyCode) {
case 37:
alert...
What is mean by +_ in JS
Hello Reader's
Sometimes you might have seen " var = +_" syntax in JS. So this line is as simple as assiging the variable to another, Where + is transfering the value of _ to var and _ is just the variable.
var _ = "D5200";
var newVar = +_;...
How to get the POST variable using Javascript
Hello Reader's!
If you have desinged the html form in PHP and want to receive the POST variables in JS then there is a method below:-
var PostVar = <?php echo $_POST['name'] ?>;
Like the way above the var PostVar will get the val...
How to get the variable by it's name using Javascript
Hello Reader's, Suppose you having a variable and you want to find it by it's name, See the example below:-
var MyVar = '12';
alert(window['MyVar']);
Output:-
12
No if you have variable like this way
var MyVar = {IND:'value12...
How to detect if web page is refreshed using Javascript
Hello Reader's! if you need to detect whether the webpage is being refreshed by using Javascript you can do this like the example below:-
function CheckRefresh() {
if(document.cookie.indexOf('mycookie')==-1) {
// cookie doesn't exist, ...
how to convert string into date format using Javascript
If you have a sting in the format of dd-mm-yyyy and you need to convert it into date format then you can see the operation below:-
var date1 = "07-11-2015";
var numbers = date1.match(/\d+/g);
var date = new Date(numbers[2], numbers[0]-1, n...
How to make custom HTML 5 email validation
Hello Reader!
If you have been working with HTML 5 validation then on incorrect email address web broser will show the default error message "please enter a valid email address".
Now you can make it custom and write your own message. Lets see t...
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 get the user's time zone using PHP and Javascript
Hello Reader! If you developing the website for a global purpose then getting the time zone of your user is a important factor.
In the example below we'll see how to get the user's time zone by using JavaScript and PHP with a custom webpage.
...
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...
Using Javascript to access liferay services
The Below code will show you how you can create the service in Liferay and how you can call that services using javascript.
For this, First you have to create service builder(service.xml) to build service using ant build-service command.
...
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 ...
Getting Device info using phone gap
In phonegap, if we want to know the device information then we have to add a plugin for the same and from that we will have a device object which describe the hardware and software of the device.
The properties include:
device.name
device....