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 10-19-2011, 01:16 AM   PM User | #1
jason_kelly
Regular Coder

 
Join Date: Sep 2011
Posts: 140
Thanks: 88
Thanked 0 Times in 0 Posts
jason_kelly is an unknown quantity at this point
help with JQuery and Forms

Hello,

How would I go about amending the code below to only be only work on the form name "login"?

the code below is not working for me =\ and im out of ideas.

Code:
<html>

<head>
 <script src="http://code.jquery.com/jquery-latest.js"></script> 
</head>

<body>
<script>
$(document).ready(function(){
$("login").bind("click keypress", function(evt) {
    var keyCode = evt.which || evt.keyCode;
    if (keyCode == 13) {
        alert("ENTER pressed");
    }
    });

    
});
</script>
<form name="login">
    <input type="text" />
    <input type="submit" id="submit1" value="First" />
    <input type="submit" id="submit2" value="Second" />
</form>
</body>

</html>
Any help is greatly appreciated.

Cheers,

J
jason_kelly is offline   Reply With Quote
Old 10-19-2011, 01:32 AM   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
are you trying to write a submit function by chance? what is it you are trying to accomplish?

also having 2 submit button in one form is generally not a good idea.
__________________
- 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 10-20-2011, 05:51 PM   PM User | #3
jason_kelly
Regular Coder

 
Join Date: Sep 2011
Posts: 140
Thanks: 88
Thanked 0 Times in 0 Posts
jason_kelly is an unknown quantity at this point
Hi Dan,

You are right, I am trying to do a submit button with it.

The two buttons are just there for an example only.

If I can make this work with one of them that would be awesome.

J
jason_kelly 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 03:27 AM.


Advertisement
Log in to turn off these ads.