Solved

jquery - Real beginner stuff.

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
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.

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now