Solved

jquery - Real beginner stuff.

Posted on 2011-09-02
2
191 Views
Last Modified: 2012-08-13
I know these questions probably seem dumb, but after reading a lot of examples, I can't find something that will simply explain/show the setup of js file.
First, in asp.net 2008 I have a choice of adding an Ajax Client Library and a jScript file.  Does it matter which one I select?
Second, In a custom js file, can I add multiple functions or do you create a new js file for each function.
Third, does every js file start with jQuery(document).ready(function() when you have referenced the jquery-1.6.2.min.js in a masterpage?

Thanks
0
Comment
Question by:Sheritlw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Accepted Solution

by:
-null- earned 500 total points
ID: 36474250
Hi there,

First of all, I would go with just a jscript file. jQuery has ajax routines built into, and I would imagine you'll just be using them over the microsoft version.  Choosing jscript file will create a new blank file.

Secondly,

Sure! put as many functions as you like in a custom file.  Normal practice would be to group your functions into logical groups in the same file.  That of course doesn't stop you from putting just one function in a file, you can do as you please. (Although in terms of performance, putting multiple functions in the same file improves load time, as the browser does not have to make a roundtrip several times to the server for each file.

Lastly,

You can reference $(document).ready in every file you include, if there is something in each you want to initialise. It however is not a requirement, a js file can simply be full of jquery functions that you call as and when.

hth

-null-

0
 

Author Closing Comment

by:Sheritlw
ID: 36475260
Thank you.  Your explanation helped a lot.
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
The viewer will learn how to count occurrences of each item in an array.

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question