Jump to content

Changing the color of div on "enter click"?


dominod

Recommended Posts

Hi,

 

I am a javascript newbie and wonders how to do this:

 

I want to change this:

 

 

.buttons a, .buttons button{    background-color:#f5f5f5;

 

 

to this

 

 

.buttons a, .buttons button{    background-color:#000000;

 

 

when enter is clicked when the form field is focued (to make it behave like a button).

 

Anyone knows how to do this?

 

This is the code for the button BTW:

 

 

<div class="buttons">    <a href="#" onclick="this.blur();parent.document.forms[0].submit();">Search    </a></div></form>

 

Link to comment
Share on other sites

I'm not sure I understand. You state you want to change a form field when it has focus, but there is no form field in your code. Plus, I'm not sure what you mean about "when enter is clicked...". Are you taking about the user CLICKING something on the page or when the user PRESSES the Enter key on the keyboard?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.