Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery UI styled text input box

jQuery UI makes buttons look nice with $('button').button();.

Is there an equivalent for text input boxes?

like image 393
Randomblue Avatar asked Jul 23 '11 17:07

Randomblue


4 Answers

There's nothing to stop you from doing $("input").button()... I like this:

$('input:text, input:password')
  .button()
  .css({
          'font' : 'inherit',
         'color' : 'inherit',
    'text-align' : 'left',
       'outline' : 'none',
        'cursor' : 'text'
  });

A fuller example.

like image 54
Corin Avatar answered Nov 03 '22 02:11

Corin


Add the class ui-corner-all to your input and post-style the input with CSS.

$('input').addClass("ui-corner-all");

http://jsfiddle.net/TTShr/

like image 21
jedierikb Avatar answered Nov 03 '22 03:11

jedierikb


I know this is old. But, if anyone is just looking to style their inputs to look more UIish, just add the following classes: $('input').addClass("ui-widget ui-widget-content ui-corner-all");

You could just hard code the classes too.

like image 19
Bernesto Avatar answered Nov 03 '22 02:11

Bernesto


To sum things up I would like to add my implementation:

$('input:text, input:password, input[type=email]').button()
  .addClass('ui-textfield')
  .off('mouseenter').off('mousedown').off('keydown');

The CSS would be:

.ui-textfield {
    font: inherit;
    color: inherit;
    background: none;
    text-align: inherit;
    outline: none;
    cursor: text;
}

See it here: http://jsfiddle.net/UXdLQ/1544/

like image 6
EliSherer Avatar answered Nov 03 '22 01:11

EliSherer