Related Content
A Look At HTMX With PHP
Drupal 11: Using Storybook To Preview Single Directory Components
Single Directory Components (SDC) consist of a directory of files that go together to create a small component on a Drupal website. The component contains all the templates, styles, script, and images needed to display some content in a consistent way.
Using Colour Schemes To Create Light And Dark Modes In CSS
Allowing users to switch between light and dark colour schemes on websites is a popular feature. You can often see a small sun or moon icon that allows you to change from light mode to dark colour scheme, or visa versa. Some operating systems and user agents also have the ability to activate a dark colour scheme, which websites also pick up and use.
Creating A Mouse "Looking" Script With JavaScript
I've seen lots of "our team" pages over the years, but one of the ones that stood out to me the most were those that had an interactive element to them. For me, it adds a bit of personality to the page and makes it feel more alive than a bunch of silhouettes of the directors.
Creating Tic Tac Toe In JavaScript Part 2: Adding A Computer Player
After creating tic tac toe in JavaScript in my previous article I decided to add a second player in the form of a computer opponent.
Creating Tic Tac Toe In JavaScript Part 1: The Game
Tic Tac Toe (or noughts and crosses) is a good game to create when learning game development as it has simple rules and a known win state.
Comments
You are going to stop people also from pressing Enter on "Submit"?
Change:
$('form input').keydown(function (e) {to:
$('form input:not([type="submit"])').keydown(function(e) {Submitted by Azizur Rahman on Mon, 07/18/2011 - 11:30
Permalinkthanks for the code , it help me alot, thanks again
Submitted by Israel R on Fri, 01/06/2012 - 20:24
PermalinkI can submit this form bt pressing teh Enter key when in a text input field (i.e if I use the Enter key instead of the tab key to move from one field to the next. I tried to prevent this on my site using teh Jquery on this page but it did not work for me either. Is there a better way ?
Chhers
Richard
Submitted by Anonymous on Wed, 02/22/2012 - 21:29
PermalinkSubmitted by Django developer on Fri, 11/03/2017 - 10:09
PermalinkAwesome :)
Submitted by Paritosh Singh on Fri, 09/27/2019 - 19:40
PermalinkThanks
Submitted by Anonymous on Wed, 11/10/2021 - 08:11
PermalinkI made a font-size slider that works great. It indicates the size with a txt. You can click the text and it will change into an input field so you can omit the slider and directly input the font-size. On blur it will set the slider & fontsize. The last step was to implement key action (enter) to blur the field and set the values. But the page where I am using it (a wordpress code-snippet plugin page) binds the enter action to 'save' the code-snippet. So now my code works, upon enter key it sets the size you input in the field, but it also saves the snippet. So I took your example, and tried adding e.preventDefault(), but it still also saves the snippet, I guess that save action isn't default. Can you tell me how I can unbind that save action?
Working jsfiddle: http://jsfiddle.net/junkfood66/e3y0jn2z/50/
Submitted by Pampus™ on Fri, 12/02/2022 - 15:12
PermalinkHi Pampus™, Thanks for reading and commenting!
I think this article might help you: https://www.hashbangcode.com/article/inspecting-and-reusing-jquery-even…
It sounds like you need to rebind an event that's already been added to the page. That code should help you do just that.
Submitted by philipnorton42 on Fri, 12/02/2022 - 15:34
PermalinkAdd new comment