jQuery

JavaScript – How to add jQuery from a JavaScript file

pièces de puzzle éparpillées sur une table

When you create a javascript file, you may want to make sure you can use jQuery. To avoid having it twice and maybe introducing incompatibilities, just add this at the beginning of the javascript file: if (typeof jQuery == ‘undefined’) { var script = document.createElement(‘script’); script.src = ‘http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js’; script.type = ‘text/javascript’; document.getElementsByTagName(‘head’)[0].appendChild(script); }

Read the article →
jQuery

jQuery – Word and Character Counter

boulier chinois à perles rouges

A small script to count the number of words and/or characters in an input or textarea field <input id=”text” name=”text” type=”text” /> <span id=”count”></span> We place the script in jQuery’s ready function to make sure the HTML has been fully loaded. $(document).ready(function() { count($(“#text”), $(“#count”)); $(“#text”).keyup(function() { count($(“#text”), $(“#count”)); }); }); function count(src, dest) { … Read more

Read the article →
jQuery

jQuery File Upload – Basic solution with a callback

montgolfières qui se gonflent au petit matin

jQuery-File-Upload How to use the basic solution from jQuery-File-Upload and make it work on every browser, with a special dedication to Internet Explorer. The basic version has the advantage of not being overloaded with libraries, and above all it is much easier to import into a site that already exists. Libraries <script type=”text/javascript” src=”//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js”></script><script type=”text/javascript” … Read more

Read the article →