google+javascriptbanktwitter@js_bankfacebook@jsbankrss@jsbank
Guest, register






Efficient and Helpful JavaScript/jQuery Tips and Tricks This free HTML JavaScript tutorial provides 45+ JavaScript/jQuery tips and tricks that help you work in JavaScript tasks better, through live HTML JavaScript example codes. List of some JavaScript tips and tricks:

- Refreshing the src of an image with jQuery?
- Check if an image is loaded or not with jQuery
- Remove selected text after mouse double click JavaScript event
- Validate an email address
- Check if an HTML control element exists
- Cancel an AJAX request
- Select all HTML checkboxes
- Selecting root element of a certain level in the document
- Searching a string in jQuery

Please go to the full post page for full detailed tips and HTML JavaScript example codes, then try some JavaScript tutorials:

- 10 Small Javascript Tricks You Should Master
- Some Basic Tips and Tricks for Speeding Up JavaScript
- 10 jQuery and JavaScript Tips and Tricks to Improve Your Code
- 5 Good and Small JavaScript Tips and Tricks


Label: JavaScript event, HTML control, HTML JavaScript example code, 45

Free iPage Web Hosting for First Year NOW



If you're still looking for a reliable web host provider with affordable rates, why you don't take a little of time to try iPage, only with $1.89/month, included $500+ Free Extra Credits for the payment of 24 months ($45)?

Over 1,000,000+ existisng customers can not be wrong, definitely you're not, too! More important, when you register the web hosting at iPage through our link, we're going to be happy for resending a full refund to you. That's awesome! You should try iPage web hosting for FREE now! And contact us for anything you need to know about iPage.
Try iPage for FREE First Year NOW
  • Moving options from list A to list B
  • 1.$().ready(function() {
    2.    $('#add').click(function() {
    3.        !$('#select1 option:selected').appendTo('#select2');
    4.    });
    5.    $('#remove').click(function() {
    6.        !$('#select2 option:selected').appendTo('#select1');
    7.    });
    8.});
  • Select all checkboxes
  • 1.$(document).ready(function(){
    2.    $("#checkboxall").change(function(){
    3.        var checked_status = this.checked;
    4.        $("input[name=checkall]").attr("checked", checked_status);
    5.    });
    6. 
    7.});
  • Get the current URL
  • 1.$(document).ready(function() {
    2.    var pathname = window.location.pathname;
    3.});
  • Check if and which key was pressed
  • 01.$(function() {
    02.    $(document).keypress(function(e){
    03.        switch(e.which){
    04.        // "ENTER"
    05.        case 13:
    06.        alert('enter pressed');
    07.        break;
    08. 
    09.        // "s"
    10.        case 115:
    11.        alert('s pressed');
    12.        break;
    13. 
    14.        (...)
    15. 
    16.        }
    17.    });
    18. 
    19.});
  • How to hide all children div except a specific one with jQuery?
  • 1.$('#target div:not(#exclude)').hide();
    2.//or
    3.$('#target').children().filter(':not(#exclude)').hide();
  • Detecting when a div's height changes using jQuery
  • 1.$('element').bind('resize', function(){
    2.alert( 'Height changed to' + $(this).height() );
    3.}
  • Delete all table rows except first
  • 1.$('someTableSelector').find('tr:gt(0)').remove();
  • Selecting root element of a certain level in the document
  • 1.1 level:
    2.$('*:not(* *)');
    3.2 level:
    4.$('*:not(* *)').find('> *');
    5.3 level:
    6.$('*:not(* *)').find('> * > *');
  • Searching a string in jQuery
  • 1.var foundin = $('*:contains("some string bla bla")');
  • Get the distance scrolled from top
  • 1.alert($(document).scrollTop());

    JavaScript by day


    Google Safe Browsing McAfee SiteAdvisor Norton SafeWeb Dr.Web