A lot of browsers support usage without JS and CSS. Especially mobile
devices or screenreaders have very bad JavaScript support, and
screenreaders read the content of the page as it's shown without
CSS.
Even though we can argue for a long time whether or not it's a good
idea to only support
Well, you could do this in two ways, one is to actually make it into a
form and the do something when the submit have been activated.
The other way includes what you probably are looking for.
You want to read the key that have been pressed. For this you need to
register the keycode on the key
Hy Steen
I totally agree with you.
And I did not know the CSS display:none will break the submit. Good to
know! THX.
cheers
tl
On Jun 27, 11:35 am, Steen Nielsen [EMAIL PROTECTED] wrote:
A lot of browsers support usage without JS and CSS. Especially mobile
devices or screenreaders have very
On 26 Giu, 06:20, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
Hi,
I have a form, with id=myForm, with a number of text fields (input
with type=text). How do I cause a form submission by pressing enter
in any of those form fields?
hi. shouldn't this be a default?
You need to insert a submit button in the form to get it working..
input type=submit
if you don't want to show the button you can always hide it using CSS.
I usually just positioning it -9000px to the left, that way it won't
show up, but if the page is read without CSS, it will be shown
A page is read without css? Hmmm I think that is really really really
rare Even more rare than a browser without js turned on. Thats
only really really rare ;-)
Or what do you mean?
instead of moving it away, why not css display:none;? Does this brake
the submit?
cheers
tl
On Jun 26,
Thanks for your replies. I have a follow up question. Let's say I
have a bunch of inputs, type=text within a div with id=myDiv. How
do trigger an action if someone presses enter within one of those text
fields? This would not be a form submission necessarily.
- Dave
On Jun 26, 5:25 am,
It's been my experience that listening for keycodes in js can be a bit
hairy. If you have a bunch of inputs, it's probably semantic to wrap them in
a form (the div too if you like), then you could take advantage of the on
built-in event listener but just prevent the actual form submission:
You should be able to intercept that button press by using the submit()
method of the form object.
$('#myForm').submit(function(){
// this method should fire whether the button was clicked with the
mouse
// or the enter button was pressed
return false;
});
form id=myForm
Hi,
Unfortunately, that didn't work for me. Here was my code:
$('#pageForm').submit(function() {
var page = $('#page').val();
if (!isInteger(page)) {
alert(The page number must be an
integer.);
PM
To: jQuery (English)
Subject: [jQuery] Re: submitting the form by pressing ENTER
Hi,
Unfortunately, that didn't work for me. Here was my code:
$('#pageForm').submit(function() {
var page = $('#page').val();
if (!isInteger(page
11 matches
Mail list logo