rick.emmet Posted June 7, 2012 Share Posted June 7, 2012 Hi Everyone, I'm confused; I went to the download page for JQuery and all I got was a script (1175 lines long). This doesn't even have any comments at the top of the script. What is this? It seems far too small to be a library. If it is a library, where does it go and how do I link to it? Any explanation will be most appreciated. Cheers, Rick Quote Link to comment https://forums.phpfreaks.com/topic/263831-implementing-jquery/ Share on other sites More sharing options...
trq Posted June 7, 2012 Share Posted June 7, 2012 jQuery is a very small (but powerful) library. You use it like any other JavaScript file. <script type="text/javascript" src="url/to/jquey.js"></script> Quote Link to comment https://forums.phpfreaks.com/topic/263831-implementing-jquery/#findComment-1352004 Share on other sites More sharing options...
Adam Posted June 7, 2012 Share Posted June 7, 2012 Which did you download? The development version is 4 lines (including a comment) and minified to keep it light. The development version is about 9,400 lines long and full of comments. Want to post the first few lines? Either way though, jQuery is light-weight. Quote Link to comment https://forums.phpfreaks.com/topic/263831-implementing-jquery/#findComment-1352007 Share on other sites More sharing options...
Mahngiel Posted June 7, 2012 Share Posted June 7, 2012 Since the jQuery framework is so common, it is likely that the user has a copy of it from Google in their cache already. Many recommend utilizing Google's API powers for your jQuery hosting (unless the site will be developed offline like on a laptop at an airport). <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> Where it goes in your source is also debated, I prefer to put it in the footer since javascript's actions are primarily against your DOM, which is best suited after the page has fully loaded. Once it's loaded on a web page, you can simply create an anonymous, self-invoking function and write your scripts (function(){ $('#some_div_id').hide(); })(); I highly recommend NetTuts+'s 30 Days to learn jQuery class. Quote Link to comment https://forums.phpfreaks.com/topic/263831-implementing-jquery/#findComment-1352018 Share on other sites More sharing options...
rick.emmet Posted June 8, 2012 Author Share Posted June 8, 2012 Hi Everyone, First, thank you for replying, the comments are very helpful! To be a little more clear about my intended use of JQuery, I wish to download the entire library and the Form Validation Plugin and place it somewhere in the htdocs folder. I want to be able to implement the form validation locally (so I don't have to be online) and test it. I do want to get opinions from all of you as to which form validation plugin (at Google?) seems to be the most trouble free. I get it that in almost every instance, linking to Google or anther CDN hosting site will perform better than having it hosted on my site. When I go live I will set up my form validation this way. Back to the download, I used the link ( http://code.jquery.com/jquery-1.7.2.js ) to navigate to what I thought would be a zip file and instead got this... (function($) { $.extend($.fn, { // http://docs.jquery.com/Plugins/Validation/validate validate: function( options ) { // if nothing is selected, return nothing; can't chain anyway if (!this.length) { options && options.debug && window.console && console.warn( "nothing selected, can't validate, returning nothing" ); return; } Etc., etc. Yesterday the site was a mess! There were a number of pages that displayed a message saying "currently in development" and as I said before, the forum was not able to process any request to join. That is still not working. Today however, I did go back to the download page and grabbed the following code... /*! * jQuery JavaScript Library v1.7.2 * http://jquery.com/ * * Copyright 2011, John Resig * Dual licensed under the MIT or GPL Version 2 licenses. * http://jquery.org/license * * Includes Sizzle.js * http://sizzlejs.com/ * Copyright 2011, The Dojo Foundation * Released under the MIT, BSD, and GPL Licenses. * * Date: Wed Mar 21 12:46:34 2012 -0700 */ (function( window, undefined ) { Etc., etc. Is this the real thing? It looks like it might be. Do I place this in the same folder as the Form Validation Plugin? Thanks again for your help! Cheers, Rick Quote Link to comment https://forums.phpfreaks.com/topic/263831-implementing-jquery/#findComment-1352277 Share on other sites More sharing options...
Mahngiel Posted June 8, 2012 Share Posted June 8, 2012 http://docs.jquery.com/Downloading_jQuery If you're going to be using that framework, get used to that site. Quote Link to comment https://forums.phpfreaks.com/topic/263831-implementing-jquery/#findComment-1352278 Share on other sites More sharing options...
rick.emmet Posted June 8, 2012 Author Share Posted June 8, 2012 Hi Mahngiel, Well, that is the correct file. I created a JS folder in htdocs and placed the 9400 line file with a ".js" extension in it. I also place just the jquery.validate.min.js file in the folder and it does all the validation on my test form. So I can do my development on the moon if I have to. Can you recommend a from validation plugin on a CDN hosting site (perhaps Google)? Thanks again for your help! Cheers, Rick Quote Link to comment https://forums.phpfreaks.com/topic/263831-implementing-jquery/#findComment-1352285 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.