All jQuery Codes

jQuery code to share content on whatsapp

In this short post, find jQuery code to share any content on whatsapp. The code first checks for mobile device and if it's a mobile device then it just creates whatsapp URL with user defined text and link to share and then just redirects it. That's it. $(document).ready(function () { $(document).on("click", '.whatsapp', function () { […]
Read the rest of this entry »

How to remove all inline styles using jQuery?

Inline styles are not recommended and it also create problem while managing the site. Here is a one liner jQuery solution to remove all inline styles from the page. $("* [style]").removeAttr("style"); Feel free to contact me for any help related to jQuery, I will gladly help you.
Read the rest of this entry »

How to copy text from one input textbox to multiple textboxes using jQuery

In this post, find jQuery code to copy text from one input textbox to multiple textboxes while typing or in real time or on paste. To achieve this, give a same class name to all the textboxes in which text needs to be copied. For example, in the below code all the textboxes are having […]
Read the rest of this entry »

How to Limit Number of Characters in Textarea using jQuery

Find jQuery code to limit characters inside textarea control. Below code also handles copy + paste and on drop event. $(function () { var nMaxLength = 150; $("#txtDesc").keydown(function (event) { LimitCharacters($(this)); }); $("#txtDesc").keyup(function (event) { LimitCharacters($(this)); }); function LimitCharacters(txtDesc) { if (txtDesc.val().length > nMaxLength) { txtDesc.val(txtDesc.val().substring(0, nMaxLength)); } else { var nRemaining = nMaxLength - […]
Read the rest of this entry »

Detect IE11 using JavaScript/jQuery

In this post, find JavaScript/jQuery code to detect IE 11. Your old code detect IE browser either using navigator.userAgent or $.browser.msie will not work for IE 11 as the User Agent string for IE 11 is changed. Previously I had posted about Detect Browsers using jQuery, but with the release of jQuery 1.9 $.browser feature […]
Read the rest of this entry »

jQuery on() – Click event not working for dynamically added element

My colleague got stuck into a problem where he was using jQuery on() method to attach the click event handlers but click event was not working for dynamically added elements. Although he knew that .bind() method doesn't work for dynamically added element but he was quite sure about .live() and .on(). Since .live() method is […]
Read the rest of this entry »