Search code examples
jqueryhtmljquery-mobiledatebox

JQuery datebox - how to attach click event to the whole input element


I observed on jQuery mobile DateBox main page how the datebox opens when you click what ever part of the input element.

Still, on their demo site, where you can observe also the used source codes, the box opens only clicking the icon.

Has anybody been able to open the box clicking the element on text side (whole element in any other part than the icon) and open the box?

It has to be possible, 'cause the example is there, but the sources of that are missing.


Solution

  • You can use the data-option: useFocus

    Ref: http://dev.jtsage.com/jQM-DateBox2/demos/opt/open.html

    Code:

    <div id="myPage" data-role="page">
        <div data-role="content">
            <input name="mydate" id="mydate" type="date" data-role="datebox"
            data-options='{"mode":"calbox", "useFocus": true}' />
        </div>
    </div>
    

    Demo: http://jsfiddle.net/IrvinDominin/S3hwr/