Jquery url validator

Jquery custom url validation

This script is used to validate url on given textbox. A simple textbox url validator. jQuery.validator.addMethod ("domainChk", function (value, element, params) { if (this.optional (element) ) return true; //--- Get the target domain, this will be in the rel attribute. var requireddomain = $(element).attr ("rel"); var regExp = new RegExp  ..

Access iframe elements using jquery

Access Iframe element

How to access IFrame element using jquery <html> <head> <script src="jquery.js" ></script> <script> $(function(){ var iFrameCont = $("iframeID").contents(); iFrameCont.find(".message").slideUp(); }); </script> </head> <body> <iframe src="" id="iframeID"></iframe> </body> </html>   ..

Jquery call a function on form submit

Function call on form submit

How to skip the form from submitting and call any function while submitting? for eg, if you are using html5, then you need a form to validate any field. Also if you are using ajax instead of direct form submit, then use the following to call the ajax function on  ..

Jquery disable right click on images

How to disable right click on image

Disabling mouse right click menu for images using Jquery $(document).on('mousedown', 'img', function(e) { if(e.which === 3){ $(this).live('contextmenu', function(e){ e.preventDefault(); }); }; }); This is will help you to avoid coping images. Jquery acts faster and simpler, which helps to avoid copying of images.  ..

How to use ajax as global function

Ajax global function

We often use jquery ajax functions in our web projects. If we can make this ajax function as global one and pass only parameters to that function we can save lot of time. Have a look at this code, <script src=''></script> <script type='text/javscript'> //Global method for making ajax-request function make_request(qdata){ $.ajax({   ..

Set interval time in for loop

Setinterval function

Set interval time in for loop, Here is the for loop has to be changed to setinterval function. For loop for(var counter=0;counter<=10;counter++) { // do your thing } setinterval function var counter = 0; var i = setInterval(function(){ if(counter <= 10) { // do your thing counter++;   ..

How to empty an array

Clean an array in javascript

When you keep filling a javascript array, it is better to clean an array whenever it is possible. there is a simple method to make an array empty, arrayName=[]; Above code will simply clean or empty an array simply.   ..

Jquery convert text to number

Jquery get text as number

Use unitary operator to convert text as a number, and validate the text have string or numbers, In Html <div class="number">400</div> In Jquery, var num = +($('div.number').text()); // unitary operator (+) if(isNaN(num)) // Div text is a number or not to validate { alert("The div text is not a number"); }   ..

Changing html content inside div tag

Javascript inner HTML example

Changing HTML inside a div using javascript Anything which we add inside the html tag will by using innerHTML function in javascript <div id="content"></div> <script type="text/javascript"> document.getElementById'content').innerHTML='Hello'; </script> The above code will help you to add or change the HTML content inside the div tag.  ..

How to load jquery library fast

Loading jquery file very fast

How to load jquery library file quickly in a document? Just use the google api file. Most of them use this, so it will be cached . You can load the jquery file very fast by copying the above url in to your application or the document/webpage.  ..

Text ticker effect in javascript

Change webpage look via text ticker

Text Ticker effect in Javascript Improve the look of webpages through Text Ticker Effect This effect is to build a webpages in a effective manner.Like flash News Scroller Wizard is a tool that allows to design latest ticker news information scroll in a few minutes and instantly see the results. So this  ..

Jquery script to find mobile device and redirect

Find mobile devices or tablet and redirect

The below code will help you to find the browser you use or the device you use and make redirection of your website accordingly to the specified website. You can use or include any one below code in your web site. Jquery code to find mobile device and redirect to specified site /** *  ..

How to find vales in array using jquery

Jquery find values in array

How to find vales in array using jquery When u run this script, if you find desire value is not found in the array then the exit status or the value will be -1 exit = $.inArray(value, array); if returns -1 means the value is not in array.  ..

Jquery to check file extension

Check the file extension while uploading

To check the file extension while uploading the file jquery can be used. var imgext = $('#file_upload').val().split('.').pop().toLowerCase(); if($.inArray(imgext, ['jpeg','jpg']) == -1) { alert('invalid extension!'); return false; The above script will help you to check the file extension, while uploading files from client side. client side check will help to validate  ..

Find xy coordinate of the mouse pointer

Javascript to display the x and y value

Javascript to display the x and y value - the coordinate of the mouse pointer. <!--script type="text/javascript" src="jquery.js"> </script--> <script> $().mousemove(function(e){ //display the x and y axis values inside the P element $('p').html("X Axis : " + e.pageX + " | Y Axis " + e.pageY); }); </script> <p>Find X and Y coordinate of the mouse pointer</p>   ..

Previous 1 2 3 Next

Tech Bluff