google+javascriptbanktwitter@js_bankfacebook@jsbankrss@jsbank






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
  • How to transform a number like 12343778 into 12.343.778
  • 1.<div id="result">12343778</div>
    1.var delimiter = '.';
    2.$('#result').html()
    3.            .toString()
    4.            .replace(new RegExp("(^\\d{"+($this.html().toString().length%3||-1)+"})(?=\\d{3})"),"$1" + delimiter)
    5.            .replace(/(\d{3})(?=\d)/g,"$1" + delimiter);
  • Count number of textarea lines
  • 1.var text = $("#textareaId").val();
    2.var lines = text.split(/\r|\r\n|\n/);
    3.alert(lines.length);
  • Logging to the firebug console
  • 1.jQuery.fn.log = function (msg) {
    2.    console.log("%s: %o", msg, this);
    3.    return this;
    4.};
    5.$('#some_div').find('li.source > input:checkbox').log("sources to uncheck").removeAttr("checked");
  • Find X/Y of an HTML element with Javascript
  • 02.var getCumulativeOffset = function (obj) {
    03.    var left, top;
    04.    left = top = 0;
    05.    if (obj.offsetParent) {
    06.        do {
    07.            left += obj.offsetLeft;
    08.            top  += obj.offsetTop;
    09.        } while (obj = obj.offsetParent);
    10.    }
    11.    return {
    12.        x : left,
    13.        y : top
    14.    };
    15.};
  • Validate Credit Card
  • 01.function isCreditCard( CC ){
    02.    if (CC.length > 19)
    03.        return (false);
    04. 
    05.    sum = 0; mul = 1; l = CC.length;
    06.    for (i = 0; i < l; i++){
    07.        digit = CC.substring(l-i-1,l-i);
    08.        tproduct = parseInt(digit ,10)*mul;
    09.        if (tproduct >= 10)
    10.            sum += (tproduct % 10) + 1;
    11.        else
    12.            sum += tproduct;
    13.        if (mul == 1)
    14.            mul++;
    15.        else
    16.            mul-;
    17.    }
    18.    if ((sum % 10) == 0)
    19.        return (true);
    20.    else
    21.        return (false);
    22.}
  • Distinguish left and right mouse click
  • 1.$("#element").live('click', function(e) {
    2.    if( (!$.browser.msie && e.button == 0) || ($.browser.msie && e.button == 1) ) {
    3.        alert("Left Button");
    4.    }
    5.    else if(e.button == 2)
    6.        alert("Right Button");
    7.});
  • How to get the native image size
  • 1.var img = $('#imageid');
    2.var theImage = new Image();
    3.theImage.src = img.attr("src");
    4.alert("Width: " + theImage.width);
    5.alert("Height: " + theImage.height);
    AIVideo-App.com
    Generate your business videos by AI with voice or just text

    chatGPTaz.com
    Talk to ChatGPT by your mother language

    AppAIVideo
    Your first FREE AI Video App

    Deepfake Video
    Deepfake AI Video Maker

    Deepfake
    Deepfake AI Video Maker

    AI Deep Fake
    Deepfake AI Video Maker

    AIvidio
    AI Video Mobile Solutions

    AIvideos
    AI Video Platform & Solutions

    AIvedio
    AI Video App Maker

    Artificial General Intelligence
    Ai and higher level Artificial General Intelligence (AGI)

    Artificial General Intelligence
    Ai and higher level Artificial General Intelligence (AGI)

    Faceswap AI Online
    Swap Faces Video, Photo & GIFs Instantly with Powerful AI Tools - Faceswap AI Online FREE

    Faceswap AI Online
    Swap Faces Video, Photo & GIFs Instantly with Powerful AI Tools - Faceswap AI Online FREE

    Faceswap AI Online
    Swap Faces Video, Photo & GIFs Instantly with Powerful AI Tools - Faceswap AI Online FREE

    Powerful AI Presentation PPT Maker for FREE
    Build an impressive presentation with our free online AI presentation app

    Your next top AI Assistant
    Claude AI, developed by Anthropic

    Your next top AI Assistant
    Claude AI, developed by Anthropic

    Temu Free $500 for New Users
    Claim Free Temu $500 Credit via Affiliate & Influencer Program

    Free TikTok Ads Credit
    Master TikTok Ads for Your Business Marketing

    Dall-E-OpenAI.com
    Generate creative images automatically with AI

    chatGPT4.win
    Talk to ChatGPT by your mother language

    First AI Product from Elon Musk - Grok/UN.com
    Speak to Grok AI Chatbot with Your Language

    Tooly.win
    Open tool hub for free to use by any one for every one with hundreds of tools

    GateIO.gomymobi.com
    Free Airdrops to Claim, Share Up to $150,000 per Project

    iPhoneKer.com
    Save up to 630$ when buy new iPhone 16

    Buy Tesla Optimus Robot
    Order Your Tesla Bot: Optimus Gen 2 Robot Today for less than $20k

    JavaScript by day


    Google Safe Browsing McAfee SiteAdvisor Norton SafeWeb Dr.Web