Preferred usage of <input> vs. <select>?

3 posts, 1 answers
  1. beauXjames
    beauXjames avatar
    20 posts
    Member since:
    Aug 2012

    Posted 28 May 2015 Link to this post

    In 'older' code in our system it seemed necessary to use a <select> element at all times when invoking and binding to a kendo ComboBox. Now, we note that there is less variance between using an <input> element and the performance appears to be identical.

    I notice that in the dojo, if there exists a fixed set of options and no dataSource, <select> is used and then the element is just initialized as kendoComboBox. On the other hand, any time a dataSource is provided, whether locally or remotely, the dojo uses the <input> element.

    When viewed in the source, there seems to be little variance except for the <select>/<input> shown after the k-dropdown-wrap. Both of which are hidden from display anyways.

    Do you have any 'input' on this?

  2. Answer
    Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 29 May 2015 Link to this post

    Hi,

    In general, the widget supports equally <input /> and <select></select> elements. There is only one additional step that the widget does when SELECT element is used and it is a re-generation of the OPTION elements. This is done on every dataSource change. When amount of the rendered data is small, in practice this additional step does not add any performance impact.

    When INPUT or SELECT will be used depends entirely on the developer preferences. If he/she wants to provide graceful degradation (when JavaScript is disabled), then it will be better to use SELECT elements with already defined OPTION elements. If this is not required, then just use INPUT element. 

    Regards,
    Georgi Krustev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
  4. beauXjames
    beauXjames avatar
    20 posts
    Member since:
    Aug 2012

    Posted 29 May 2015 in reply to Georgi Krustev Link to this post

    That's a perfect explanation. Exactly what I needed to know. Appreciate your time on the topic.
Back to Top