[jQuery] Re: Bindind keydown function to a form - submit on keydown (value change)

2010-01-20 Thread Mircea
Thanx Nathan,
It works. It does change the class to the #family form. Is it possible
to make it change the class to the Option element?

option class=option value=Georgia label=GeorgiaGeorgia/
option
option class=option value=Times New Roman label=Times New
RomanTimes New Roman/option
option class=option value=HelveticaNeue-Light label=Helvetica
Neue LightHelvetica Neue Light/option

I've tryed with the following and it does not work:

 $(.option).bind(change keypress, setFamily);
 $(option).bind(change keypress, setFamily);


Re: [jQuery] Re: Bindind keydown function to a form - submit on keydown (value change)

2010-01-20 Thread Nathan Klatt
On Wed, Jan 20, 2010 at 11:20 AM, Mircea i...@amsterdamsat.com wrote:
 Thanx Nathan,
 It works. It does change the class to the #family form. Is it possible
 to make it change the class to the Option element?

You mean style the option element?

function setFamily() {
  $('#family :selected').parent().andSelf()
.css('font-family', $('#family :selected').val());
}
setFamily();
$('#family').bind(change keypress, setFamily);

http://jsbin.com/agifi/edit

Nathan


Re: [jQuery] Re: Bindind keydown function to a form - submit on keydown (value change)

2010-01-20 Thread Nathan Klatt
Sorry,

function setFamily() {
  $('#family').css('font-family', $('#family :selected').val());
}
$(#family option).each(function() {
  $(this).css('font-family', $(this).val())
});
setFamily();
$('#family').bind(change keypress, setFamily);

http://jsbin.com/agifi/2/edit

Nathan


[jQuery] Re: Bindind keydown function to a form - submit on keydown (value change)

2010-01-20 Thread Mircea
Thanx a lot Nathan!
It works like a charm.

All the best