Solved

jquery - Real beginner stuff.

Posted on 2011-09-02
2
190 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
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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

825 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