Category Archives

Archive of posts published in the category: Jquery
Nov
15

Find difference between two numeric values

<script> var x = 12; var y = 15; var z = Math.abs(x-y); alert(z); </script>  

Nov
12

How to check for an undefined in jquery

<script> if(typeof(a) == “undefined”){ alert(‘undefined valiable’); } else { alert(‘OK’); } </script>

Oct
16

Check Value numeric or not?

Check value is numeric or not in jquery:

Oct
2

Create jQuery plugin

// function definition

(function ( $ ) {

$.fn.greenify = function() {
this.css( “color”, “green” );
return this;
};

}( jQuery ));

//function calling

$( “a” ).greenify();

Sep
30

Open url in new tab in jquery

window.open(“your url”, ‘_blank’);

Sep
22

Get page url in jquery

Paste this code in html body: <a href=”#detail” onclick=”CallUrl();”>Click to get url</a> Now start scripting 1. Add jquery library file <script src=”//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js”></script> 2. paste the following code in script tag as below: <script> // function definition function CallUrl(){ var pageURL = $(location).attr(“href”); alert(pageURL);…