Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

jquery - Real beginner stuff.

Posted on 2011-09-02
2
Medium Priority
?
200 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 2000 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article discusses how to create an extensible mechanism for linked drop downs.
A quick Powershell script I wrote to find old program installations and check versions of a specific file across the network.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses

636 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