Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 

Setting minutes to a negative value

What happens if we set the minutes value to -80? Here is the example for setting a minutes in negative. var dt= new Date(); document.write( dt + "<br><br>"); dt.setMinutes(-80); document.write( "<br><br>" + dt ); ...

How to put validation on a file at the the time of selection in Jquery?

Sometimes we need to apply validations on file-size and file-type of a file while uploading. We can check this by attaching a function to the "change" event. Examlpe: <input type="file" name="uploadFile" id="uploadFile" class="upload" t...

jQuery clone ( ) Method

This method is used to make a copy of matched elements. Using this method we can also makes a copies of their child nodes, texts, and attributes. In another words it makes the duplicate of the matched elements. Syntax : $(selector).clone(true...

How to use angular.foreach with ng-repeat?

We use ng-repeat to iterate over the properties of an object. It instantiates or clones a template once for each item in a collection. Similarly,angular.foreach invokes a function that is an iterator function once for each item in an obj colle...

jQuery after ( ) Method

This method is used to insert the data after some specified tag or content . It is just same as jQuery append( ) method. If you want to insert the data before some specified tag or content then you should use before ( ) method. Syntax : $(se...

jQuery append( ) Method

This method is used to insert the data at the end of the selected elements . It is just opposite of the prepend( ) method . Prepend ( ) method is used to insert the data at the beginning of selected elements . Syntax : $(selector).append(cont...

jQuery prepend ( ) Method

This method is used to insert the data at the beginning of the selected elements . It is just opposite of the append( ) method . Append ( ) method is used to insert the data at the end of selected elements . Syntax : $(selector).prepend(conte...

jQuery before( ) method

This method is used to insert the data before some specified tag or content . It is able to add the content at specified position by the parameter after matching the elements . insertBefore( ) and before( ) methods are same, they perform same tas...

jQuery Text()

This method is used to set the content of selected elements even we can get the text content also .When this method is return the text content ,it returns the all matched elements without the HTML markup. And when this method is used to set the c...

Set Minutes method Js

We can set the minutes part of the date object by using setMinutes function Sets the minutes value in the Date object using local time. Set methods take optional arguments using the value returned from corresponding get methods, if you do not spe...

Parsing the Date in javascript

The Date.parse() method takes a date string, and returns the number of milliseconds since midnight of "November 1, 1997 10:15 AM". if the string is unrecognised or contains illegal date values (e.g. 2015-02-31) Syntax Date.parse(dateVal) ...

How to make HTML by using the Json Array

Hello Reader's If you having the data coming from the Json array and you need it to show in html table. Then you can perform the short Jquery action for making it automated restful service. Here the code of javascript var _table_ = docum...

How to make time slice using Javascript

Hello Reader's If you are genrating the time in Unix time stamp and want to show it like 5 min ago or 3 hours ago then you can use the code below:- Here we are using NOW of the unix timestamp function timeSince(ts){ now = new Date(); ...

How to Use Prototype?

The application runs faster after the prototype property of the GameObject is defined. As a direct result, every instance of GameObject references the methods within GameObject.prototype, taking them as their own methods. // define the GameO...

How to make the navbar tab active on click?

To make the clicked tab active in the navigation bar, the <li> corresponding to the clicked href in index.html introduces the css of 'active' class and removes the 'active' class from the previous <li> on click. Example: index....

jQuery HTML()

This method is used to change the content of the elements . It change only selected elements .It can also replaces the selected content with new content.It doesn't take any arguments. Syntax : $(selector).html() Return content : $(se...

Javascript constructor()

Lets talk about a constructor. It is actually a function to serve the purpose of using as a constructor. You can write a function to use it as a constructor or call it as a normal function, or use it both ways. You can easily perform the task o...

Date set hour function

Javascript Date.setHours() method sets the hours for a specified date according to local time. It set the hours, minutes, seconds, and milliseconds fields of a Date date.setHours(hours) date.setHours(hours, minutes) date.setHours(hours,...

Setting a Date

Sets the day of the month for a specified date object using local time. dateObjectName.setDate(dayValue) dateObjectName is the name of a Date object. dayValue is an integer from one to thirty-one, representing the day of the month. F...

Escaping string in Javascript

The escape function returns a hexadecimal encoding of an argument in the ISO Latin-1 character set that contains the contents of charstring. The Syntax is: escape("string") String is a string in the ISO Latin-1 character set. The value...

Converting a value to Integer

When the user types a value in an edit box or selects a value from a text-based control, the value is considered a simple group of words and the browser may not be able to identify or categorize what exists in a text-based control. The parsetInt(...

Global variables in Angularjs

There are two ways to use global variables: 1.$rootscope 2.service 1- We can use rootscope which is the parent of all scopes. Values exposed there will be used in all controllers and templates. We can use this in a simple way by just in...

How to load data on scrolling top using angularjs?

First you need make a directive for this. mainApp.directive("loadMoreData", [function() { return { restrict: 'ACE', link: function($scope, element, attrs, ctrl) { // alert("check"); ...

Compare two dates with JavaScript.

If you want to compare two dates, the Date object will do the following purpose. This describes the JavaScript Date Object including properties, constructors, and methods. Here is the code example :- var d1 = new Date(); var d2 = new Dat...

Storing objects in local storage.

If you want to store Javascript objects in local storage, you can use HTML5 local storage. Here is the code :- var dashboard-data = { 'one': 1, 'two': 2, 'three': 3 }; // Put the object into storage localStorage.setItem('dashboard-data'...

Parse JSON in JavaScript?

Suppose you have response somewhat like this: var response = '{"result":true,"total-count":1}'; var getValues = JSON.parse(response); document.write(getValues.result + ", " + getValues.total-count; You can simple use JSON.parse() method to...

What is the scope of variables in JavaScript?

Scope is the set of variables, objects that you have access to. Here are some examples that will explain you about scopes :- 1.A globally-scoped variable var a = 1; // global scope function one() { console.log(a);...

Event binding on dynamically created elements?

Suppose your page is creating elements dynamically with the class name egSample, you need to bind the event to a parent which already exists. You need to use the .on() method to implement this task. Here is the syntax of how to use it :- ....

How to remove class in Jquery?

JQuery uses a built-in .removeClass() method to remove a class. For example: <div class="demo">Hello </div> To remove demo class in JQuery you need to execute the following code: <script> $( "div" ).click(func...

Ajax Call using Jquery

To call ajax you need to execute the following code: $.ajax({ type: "POST", url: 'pagename.php', //location of the server data: varData, //data send to the server ...

How to return multiple variables using Javascript

Hello Reader's!, If you have a condition in which you need to return two or more variable from function like below:- functions() { //you calculation for result return $a, $b; } Now you will face the error. But you can use the arr...

Converting innerhtml javascript to jquery using $.append

Suppose you have an html code like this. <input type="button" id="btn-press" value="Submit!"> <div id="egText></div> If now you want to add some text into this div,you need to attach an event handler and You should mov...

Update dropdown values based on another dropdown using jQuery

If you want to update the values of the dropdown based on the values of other dropdown. Here is the example where If I choose Chicken as my where from. My where to should display Baked potato, Mutton, fish. <form class="foodorder hide">...

Add classes and change text using jquery function to add class and remove class on multiple buttons

You need to give class to the button and attach the .on() method with it. If you have multiple buttons that when you click one, it changes classes & the text inside. Here is the simple code to do this: $('.EgClassName').on('click', fun...

Get desired page on clicking a link using ui router in angularjs?

How to go to the desired page on clicking a link when the same link is present in more than one page using ui router in angularjs? If you have one link present in more than one page and you want to redirect to the page from where you came to t...

How to pass xml data in Jquery

Hello Reader's!, If you have given a xml data and you need to parse it into Jquery, Then you can use the parseXML function. Let's see the example below:- var xml='<Pages><Page Name="test"><controls><test>parsing into ...

Sorting an array of JavaScript objects

Hello friend, I have a javascipt array object. Now i will try to sort price in this array. For Example: var data = [ { "h_id": "3", "city": "Dallas", "state": "TX", "zip": "75201", "price"...

Validate textbox only for integer and float numbers on a button click.

We can validate a textbox on a button click by calling a function and using jquery. I am using regex for integer and decimal numbers and match method for the comparison. Here is the code: <html> <header ng-controller="menuCont...

How to add class to first element with jquery?

To add class to first child of an element you will use :first selector as follow: $(selectorname:first).addclass('classname'); For example: <div class="demo"> <p>hello</p> <p>hiii</p> </div> ...

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...

Javascript DOM -document.getElementById( ) Method

This method is used to get the elements after given specified id. Using this method we can get value from the input text field. But before to get value from input field , we need to define id for the input field. Syntax: document.getElement...

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...

Allowing user to select same day date using foundation datepicker

While using foundation datepicker we came across on issue while picking date for the same day i.e if today is 5th then user was not able to pick it from calender as it was disabled. The issue comes when you are in timezone that is in - of UTC : ...

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...

Introduction and Basic Overview of JavaScript "Strict Mode"

Introduction: Strict Mode is one of the new feature introduced in ECMAScript5 edition. Strict Mode is a group of the language that remove disfavor features. The Strict mode is not mandatory, it means that if we want o...

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(); $...
1 22 31
Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: