Solved

Help in jQuery closing tags

Posted on 2011-03-09
1
348 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
ID: 35086258
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
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…

920 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

12 Experts available now in Live!

Get 1:1 Help Now