Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-18-2011, 10:09 AM   PM User | #1
chrisfozz
New Coder

 
Join Date: Jul 2011
Posts: 13
Thanks: 7
Thanked 0 Times in 0 Posts
chrisfozz is an unknown quantity at this point
How to apply a jQuery selector to a form or button?

The link “small Window ” opens the test page in a small window, how do I do the same thing with the “small Window” button?
You can see a working example of this page at
http://fozz.dyndns-ip.com/testingser...w/greybox.html

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>fozz</title>
<link href="greybox/greybox2.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" src="greybox/jquery.greybox2.js"></script>
<!-- start Greybox -->
<script type="text/javascript">
$(document).ready(function() {
  var gbOptions = {
    gbWidth: 700,
    gbHeight: 550
  };
	$('.smallWindow div').greybox(gbOptions);//this has no effect
	$('.smallWindow a').greybox(gbOptions);
}); 
</script>
<!-- end Graybox -->
</head>
<body>
  <ul>
    <li><a href="testPage.php">large Window</a></li>
    <li class="smallWindow"><a href="testPage.php">small Window</a></li>
  </ul>
<div class="smallWindow">
<form action="testPage.php" method="get" name="mybutton">
  <input name="mybutton" type="submit" value="test page">
</form>
</div>

</body>
</html>
chrisfozz is offline   Reply With Quote
Old 11-18-2011, 01:17 PM   PM User | #2
DanInMa
Senior Coder

 
DanInMa's Avatar
 
Join Date: Nov 2010
Location: Salem,Ma
Posts: 1,307
Thanks: 12
Thanked 204 Times in 204 Posts
DanInMa is on a distinguished road
Code:
$("input[name=mybutton]").click(function(){
//do something
})
__________________
- Firebug is a web developers best friend! - Learn it, Love it, use it!
- Validate your code! - JQ/JS troubleshooting
- Using jQuery with Other Libraries - Jslint for Jquery/other JS library users
DanInMa is offline   Reply With Quote
Old 11-18-2011, 04:52 PM   PM User | #3
mvmacd
New Coder

 
Join Date: Nov 2011
Location: New England
Posts: 62
Thanks: 0
Thanked 10 Times in 10 Posts
mvmacd is an unknown quantity at this point
From the looks of it, this greybox thing is automatically sets an event listener to certain objects, like an <a> when you perform .greybox() on it. I tried adding the same .greybox(gbOptions) to the button, but it had no affect.

It seems like you either are going to read the documentation of greybox to see if it supports buttons, or dig into the jquery.greybox2.js and try to fix it yourself.
mvmacd is offline   Reply With Quote
Users who have thanked mvmacd for this post:
chrisfozz (11-23-2011)
Old 11-23-2011, 04:16 PM   PM User | #4
chrisfozz
New Coder

 
Join Date: Jul 2011
Posts: 13
Thanks: 7
Thanked 0 Times in 0 Posts
chrisfozz is an unknown quantity at this point
re the above code snipit, i've either put this in th wrong place or there is some other problem; it still does not work.
I've decided to leave this one for the time being and have addopted a different approach to the page.
Many thanks for taking the time to look at this.
Regards
Chris
chrisfozz is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:11 PM.


Advertisement
Log in to turn off these ads.