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>

 

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.