Solved

Help in jQuery closing tags

Posted on 2011-03-09
1
354 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
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…
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…

829 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