Jump to content
Sign in to follow this  
iwato

Combining jQuery and Javascript

Recommended Posts

General Question: Though aware that jQuery is just an adapted form of Javascript, I am confused about their simultaneous use and interaction. Although it seems very probable that one can employ jQuery wherever one employs Javascript, can one employ Javascript wherever there is jQuery. In my previous example entitled Turning the jQuery Overlay Tool Target Property into an Array I am wondering whether I could just as easily create my envisioned target property array inside the JQuery code as outside. For example, would it make a difference if I wrote,

<script>$(window).load(function() {	var overlay_target = Array('#overlay_1', '#overlay_2', ,,,, '#overlay_N);	$("img[rel]").overlay({		effect:"apple"	});	$("em.EM_Overlay").overlay({		effect:"apple",		target:"overlay_target[]"	});});</script>

or

<script>var overlay_target = Array('#overlay_1', '#overlay_2', ,,,, '#overlay_N);$(window).load(function() {	$("img[rel]").overlay({		 effect:"apple"	});	$("em.EM_Overlay").overlay({		 effect:"apple",		 target:"overlay_target[]"	});});</script>

Roddy :Pleased:

Share this post


Link to post
Share on other sites

jQuery is Javascript. It's not a different language, it's a library that someone created using Javascript. You can mix them in any way that keeps the syntax legal. The $ identifier in jQuery is a Javascript function object. Functions are objects in Javascript, so you can call it like a function or access properties and methods like an object. That's not something added by jQuery, that's a feature of Javascript that makes jQuery possible. If you want to assign an array you can do it like this: target:overlay_target or inline: target:['#overlay_1', '#overlay_2', ,,,, '#overlay_N']

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...