Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Creating a cntrl S event
Old 06-15-2011, 12:56 PM Creating a cntrl S event
numbenator's Avatar
Webmaster Talker

Posts: 523
Location: London
Trades: 0
Hi Everyone.

Im struggling to create a jquery click event ( cntrl S ) that when pressed will collect some form values and pass via ajax to my script on the server that saves the information..

Could someone please help me out on this.

Mucho appreciated.

Steve
__________________

Please login or register to view this content. Registration is FREE

Last edited by numbenator; 06-15-2011 at 12:57 PM..
numbenator is offline
Reply With Quote
View Public Profile Visit numbenator's homepage!
 
 
Register now for full access!
Old 06-15-2011, 01:00 PM Re: Creating a cntrl S event
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,383
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Code:
if (event.ctrlKey && event.keyCode == 83) {
// do something here
}
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 06-15-2011, 02:06 PM Re: Creating a cntrl S event
numbenator's Avatar
Webmaster Talker

Posts: 523
Location: London
Trades: 0
HI thanks

But i get an event not defined error with that
__________________

Please login or register to view this content. Registration is FREE
numbenator is offline
Reply With Quote
View Public Profile Visit numbenator's homepage!
 
Old 06-15-2011, 02:09 PM Re: Creating a cntrl S event
numbenator's Avatar
Webmaster Talker

Posts: 523
Location: London
Trades: 0
Ok so i have updated the script,

to::

e = jQuery.Event("keydown");

if (e.ctrlKey && e.keyCode == 83) {
alert ("Save Restaurant");
}

WHich doesnt error BUT the cntrl S when pressed, tries to save the page in the normal way
__________________

Please login or register to view this content. Registration is FREE
numbenator is offline
Reply With Quote
View Public Profile Visit numbenator's homepage!
 
Old 06-15-2011, 02:22 PM Re: Creating a cntrl S event
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,383
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
No idea how event "bubbling" occurs in jquery at all, never used it, never likely to

But basically you need to stop the event "bubbling" up past and through your handler, in real javascript you would set the return value from the handler to false.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Creating a cntrl S event
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.24615 seconds with 12 queries