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
Refresh the parent window and close the child window on clicking the button in child window
How to refresh the parent window and close the child window on clicking the button in child window using JavaScript
If you want to close your child window and refresh its parent window on click of a button, we can do that with the help of foll...
How to subtract days from a given date?
Hello Reader's. If you have given a date and you just need to add or subtract number of days from it then you can use the code below:-
var SubDays = 15;
$.datepicker.formatDate('yy/mm/dd', new Date() - SubDays) ;
Or you can also calculat...
How to convert Json Object into Json Array
Hello Reader's.
If you have a json object and you need to convert it into array then you just need to write the code below, and you will get the array converted format.
var obj = {"0":"1","1":"2","2":"3","3":"4"};
var arr = [];
for (elem ...
How to change HTML tags using Javascript
Hi If you want to change the tags of HTML with another tags then you can perform this action using JS in realitme.
Let's consider and example to change the <h2> tag with <i> using JS.
<h2 class="xyzxterms" style="cursor: defaul...
What is the best place to load JS in html
Hello Reader's!, If you need to know which is the best place for putting the JS.
You can put the js functions in the head part. But it'll be a good habit to put all of your functions in a separate file. You can also call for the external script...
How to detect if caps lock is on/off
Hello Reader's, If want to make alert when the upper/lower case letter key is pressed. Then by using Javascript you can see it in the code below:-
$('#cap').keypress(function(e) {
var s = String.fromCharCode( e.which );
if ( s.toU...
How to add minutes in a given date using Javascript
Hello Reader's, If you need to add some minutes to a given date, Then by using Javascript you can use as follows:-
var d1 = new Date (),
d2 = new Date ( d1 );
d2.setMinutes ( d1.getMinutes() + 50 ); //adding 50 min to the date
alert ( d...
How to detect a textbox's content has changed
Hello Reader's
If want to detect if text box value changed the alert box open to user. Then you can perform this function by using the Javascript. The function is written below:-
$(function() {
var content = $('#txtbox').val();
$...
How to make a simple file reader using Javascript
Hello Readers, If you developing the website to browse any file and showing its's content on the web page, Then by using Javascript you can do this as follows:-
function readSingleFile(e) {
var file = e.target.files[0];
if (!file) {
...
HTML5 Canvas Game
Canvas can be used to draw graphs, shapes, images, and to make animations.
Here is the example below for making the game in canvas
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
...
Display image before upload using javascript/jQuery
This post demonstrates how to display an image prior to uploading it on server.
This demo uses the JavaScript's readAsDataURL method of reader API which will read image as url.
<html>
<head>
<script src="https://a...
Middleware in Express JS
Middleware is the core idea of Express.js used behind processing the request and routing. By seeing how middleware functions, you can make more maintainble applications with less code. The minute a solicitation is gotten by an Express.js applicat...
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 },
...
ngCordova oauth facebook
I want to create a facebook login for my ngCordova hybrid app.In backend i use node js.But in client i've saw a plugin which use clientID(app id) from facebook developers.I don't know how to create this client or how to work with this plugin.Doe...
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...
How to build a native menu using ionic cordova?
I'm using ionic to build an hybrid application.I want to have some menus native (my menus are using ionic css and i think are not native).How i can build a native menu and what i should use ?
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...