Solved

Help in jQuery closing tags

Posted on 2011-03-09
1
346 Views
Last Modified: 2012-05-11
Hi,

I have a jQuery modal box on my website (it opens on right mouse click).

There are 2 versions and one them works properly the other one doesn't - because I'm confused with all these: { }); ... opening, closing tags

So here is the properly working version:

jQuery("#message1").mousedown(function(e) {
					if (e.which === 3) {
				
					AttentionBox.showMessage("This is a the Hello World example");
				}
				
				});

Open in new window


now here is another version - it works as regular left mouse click:

jQuery("#message9").click(function()
				{
					AttentionBox.showMessage('Share this image online',
					{
						inputs : 
						[
							{caption: "FULL SIZE - copy and paste into forum", value: "[URL=<?php echo curPageURL();?>][IMG]<?php echo Config::$frontendPath.Config::$images['imagePath'].$iv->image['path']; ?>[/IMG][/URL]" }, 
							{caption: "THUMBNAIL - copy and paste into forum", value: "[URL=<?php echo curPageURL();?>][IMG]<?php echo Config::$frontendPath; ?>data/thumbs/<?php echo $iv->image['time']; ?>192x192/<?php echo $iv->image['image']; ?>[/IMG][/URL]" } 
						]
					});
				});

Open in new window


but when I try to modify it, so it opens on right mouse click it doesn't work, I guess I miss one of these });, but I'm not an expert, so I don't know where to put it:

jQuery("#message9")[b].mousedown(function(e) {
					 if (e.which === 3) {[/b]
					 
					AttentionBox.showMessage('Share this image online',
					{
						inputs : 
						[
							{caption: "FULL SIZE - copy and paste into forum", value: "[URL=<?php echo curPageURL();?>][IMG]<?php echo Config::$frontendPath.Config::$images['imagePath'].$iv->image['path']; ?>[/IMG][/URL]" }, 
							{caption: "THUMBNAIL - copy and paste into forum", value: "[URL=<?php echo curPageURL();?>][IMG]<?php echo Config::$frontendPath; ?>data/thumbs/<?php echo $iv->image['time']; ?>192x192/<?php echo $iv->image['image']; ?>[/IMG][/URL]" } 
						]
					});
				});

Open in new window


      
0
Comment
Question by:jhmplondon
1 Comment
 
LVL 19

Accepted Solution

by:
Albert Van Halen earned 125 total points
Comment Utility
You need a closing curly bracket for the if statement.

jQuery("#message9").mousedown(function(e) {
	if (e.which === 3) {
		AttentionBox.showMessage('Share this image online', {
			inputs : [{
				caption: "FULL SIZE - copy and paste into forum",
				value: "[URL=<?php echo curPageURL();?>][IMG]<?php echo Config::$frontendPath.Config::$images['imagePath'].$iv->image['path']; ?>[/IMG][/URL]"
			},{
				caption: "THUMBNAIL - copy and paste into forum",
				value: "[URL=<?php echo curPageURL();?>][IMG]<?php echo Config::$frontendPath; ?>data/thumbs/<?php echo $iv->image['time']; ?>192x192/<?php echo $iv->image['image']; ?>[/IMG][/URL]"
			}]
		});
	}
});

Open in new window

0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

772 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

15 Experts available now in Live!

Get 1:1 Help Now