jQWidgets Forums

jQuery UI Widgets Forums General Discussions Standard HTML Input

Tagged: 

This topic contains 4 replies, has 2 voices, and was last updated by  gasetr 13 years, 1 month ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • Standard HTML Input #3420

    gasetr
    Blocked

    I’m trying to set the width for a standard HTML input, but for some reason jqWidgets ignores the “style: 200px;” declaraction.

    To get around this I’ve used the following code which seems to work well:

    $(“#Username”).jqxButton({
    width: 200,
    theme: “”
    });

    But I’m wondering if there is a better way to achieve the same result?

    Standard HTML Input #3423

    Peter Stoev
    Keymaster

    Hi gasetr,

    Each widget has ‘width’ and ‘height’ properties. When the widget is initialized, its HTML element’s width and height are set to the ‘width’ and ‘height’ properties. That’s the reason why the HTML settings are ignored.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Standard HTML Input #3424

    gasetr
    Blocked

    I thought something might be going on in the background.

    So is my idea of using jqxButton with no theme as indicated above a suitable way of controlling the width of an HTML input, or should I be doing this using some other method?

    The reason I ask is because there are jqxMaskedInput and jqxNumberInput widgets, but no simple jqxInput widget.

    Standard HTML Input #3425

    Peter Stoev
    Keymaster

    Hi gasetr,

    If you are creating a button widget, the way to set its width or height is to set its width or height properties.

    As we don’t have a basic TextBox widget, you can use the HTML Input Tag and initialize it as a standard HTML element.

    The following code initializes an Input Tag with Width set to 200px.

    <input style="width: 200px;" />

    Bets Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Standard HTML Input #3426

    gasetr
    Blocked

    Hi Peter,

    As I mentioned above, I was not able to set the width using the style, so I cheated a little by applying the jqxButton attribute to my input field.

    It works and it allows me to use other settings (such as disable) with the input, just as I would do with a button. I’m happy the results, but I’d like confirmation on whether or not this is a good practice.

    Also, is there any thought of adding a simple jqInput to the library, so Input Tags can be handled like any other widget?

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.