Blogger Plug 'n' Play

NOTICE

Adfly Links not working Find Direct Links HERE
Showing posts with label JavaScript. Show all posts

MouseHover and other events not working on Disabled Input in FireFox n Sometimes in Chrome - ( Solution )

We solve this situation by adding a JS function and CSS style. We just add an overlay on disabled input field and Run mouse events on it. See demo below for full code

Learn more »

Check all checkboxes on check th check box

two functionalities og Demo

1) check all check boxes in TD on check of check box in TH of table TR
2) If we check all check box manually then check box in TH also get check.

Learn more »

Tab and Tab+Shift focus on selected div




$(document).ready(function() {

lastIndex = 0;
     $(document).keydown(function(e){
        if(e.keyCode==9)
        var thisTab = $(":focus").attr("tabindex");
if(e.keyCode == 9) {
if(e.shiftKey) {
  //Focus previous input
  if(thisTab == startIndex){
$("#"+tabLimitInID).find('[tabindex='+lastIndex+']').focus();
        return false;
        }

}else {
 if(thisTab == lastIndex){
$("#"+tabLimitInID).find('[tabindex='+startIndex+']').focus();
        return false;
        }
}
}

     });      


 var  setTabindexLimit = function(x,fancyID){
console.log(x);
     startIndex = 1;
lastIndex = x;
tabLimitInID = fancyID;
$("#"+tabLimitInID).find('[tabindex='+startIndex+']').focus();
  }

setTabindexLimit(10,"DivWithTabIndex");


});
Learn more »

Detach() jQuery example

Following code showing examples of:

1) Detach() jQuery
2) How to same multiple Detach() from same classes on page and save detached content in an array.
3) Displaying detached content in a div on clicking respective "See More" text.
4) Using :gt which is used to detach all li's greater then index 4.
5) How to use check boxes as a component which can be used multiple times in a page with simple copy/paste without any change in JS code or classes name or anything. 

Learn more »

Hide Div on Click Outside jQuery

There are two methods using which we can close a div when a user click out side it.

1)Using below code we can close div


2) Using this method also we can close Div but it also closes the Div when clicked on scroll bar.

Learn more »

Textbox Dynamic Word Count, Show remaining words and word count below textbox

Learn more »

How to hide or remove div using Escape key from keyboard using JavaScript and jQuery

Using JavaScript


<script type="text/javascript">
 window.onkeyup = function (event) {
  if (event.keyCode == 27) {
    document.getElementById(boxid).style.visibility="hidden";
  // window.close();
  }
 }
</script>


Using jQuery


$( document ).on( 'click', function ( e ) {
    if ( $( e.target ).closest( elem ).length === 0 ) {
        $( elem ).hide();
    }
});
$( document ).on( 'keydown', function ( e ) {
    if ( e.keyCode === 27 ) { // ESC
        $( elem ).hide();
    }
});
Learn more »

Countdown Timer then Show Download Link using Javascript

This code can be used in situation where we want to show a countdown before showing any link or anything

See Demo
Learn more »

How to Type only selective text in a Text Field/Box

We can Disable some characters from being written in a text field by using below functions



with JQuery


 $("input").keypress( function(e)
{ var chr = String.fromCharCode(e.which);
 if ("12345NOABC".indexOf(chr) < 0)
 return false;
 }); 


without JQuery 


 document.getElementById("foo").onkeypress = function(e)
 { var chr = String.fromCharCode(e.which);
 if ("12345NOABC".indexOf(chr) < 0)
 return false;
};
Learn more »

JavaScript PDF Reader/Viewer to Embed in a Webpage

JavaScript based PDF reader/ viewer ca be used to embed a viewer on webpage to read PDF file. It also have extended capabilities like Zooming, Search next page and prev page, Goto page box.

We can pass a parameter to use any PDF file with is viewer.

See DEMO and get Files HERE
Learn more »

Check if text field contains only Numericals

function check()
{
    var val = document.getElementById("chkk").value;
    if(val.match(/^\d+$/)) {
       alert(document.getElementById("chkk").value);
     }
    else{alert("Please entere valid number");}
   
}
Learn more »

Validate/Get Checked radio button value in JavaScript


Some times there is a need to fetch the value of radio option selected by user. At the same time there is also the requirement to give alert or error if no radio value is selected to make sure if user select at least one value.

Visit following Link for Example
Learn more »