Joe Joe - 1 month ago 9
HTML Question

JQuery Mobile - Display An HTML Form Inline

Goal: Display textbox and submit button on the same line in Jquery Mobile.

Problem: They will not display on the same line.

I've tried many times to display the textbox and submit button on the same line, but it never works. Here is my code and the combinations I used...

<form method="GET" style="display: inline-block;">
<input type="text" name="id" value="Other">
<input type="submit" data-type="button" data-icon="plus" value="Add">
</form>


That did not work.

<form method="GET">
<span>
<input type="text" name="id" value="Other">
<input type="submit" data-type="button" data-icon="plus" value="Add">
</span>
</form>


Neither did this.

<form method="GET">
<ul style="display: inline; list-style-type: none;">
<li style="display: inline;"><input type="text" name="id" value="Other"></li>
<li style="display: inline;"><input type="submit" data-type="button" value="Add"></li>
</ul>
</form>


What am I doing wrong and how can I achieve my goal?

Thanks and merry Christmas!

Answer

Would a Grid Layout work?

HTML:

<fieldset class="ui-grid-a">
    <div class="ui-block-a">
            <input type="text" name="id" value="Other">
    </div>
    <div class="ui-block-b">
            <input type="submit" data-type="button" data-icon="plus" value="Add">
    </div>
</fieldset>
Comments