Width of input strength element to size to its content / value

I'm trying to erase an input element so that its text looks like plain / inline text, and I have reset almost all the css properties that may have, but I can’t get the width of the input to adjust / reduce its contents ( input { width:auto; min-width:0; }does not work). It obeys an arbitrary width, as input { width: 10px; }, therefore, obviously, its width is adjustable.

I see people trying to do this using javascript (the fiddle from the answer no longer works), so I'm wondering if I even want to.

Here's the fiddle .

+5
source share
2 answers

, snafu ? , jQuery.

http://jsfiddle.net/2fQgY/8/

The date is <span class="dateSpoof"></span><input class="myDate" type="hidden" value="foo" />. 
Thanks for coming.

$('.myDate').datepicker({
    showOn: 'button',
    buttonText: 'select...',
    onClose: function () {
        var dateText = $(this).val();
        $('.dateSpoof').html(dateText);
        $('.ui-datepicker-trigger').hide();
    },
    dateFormat: 'd M yy'
});

, : http://jsfiddle.net/2fQgY/11

, , : http://jsfiddle.net/2fQgY/14

+1

All Articles