Reputation: 51
I have the code where I am using the query Mobile version 1.4.4 to develop a mobile page. But the problem is I want to put the label, input box and a small search image in one line. The label and input box are coming correctly in one line but image is coming in the next line. Below is my code.
<div data-role="fieldcontain">
<label id="Nationalitylbl">*Nationality:</label>
<input type="text" name="Nationality" id="Nationality" value="" style="width:80%" readonly/>
<img src="%bind(:13)" name="Ntlylkp" onclick="nationalityPopUp();"/>
</div>
Upvotes: 1
Views: 102
Reputation: 420
Set float left to image input and label
.nationality .ui-corner-all input {
padding-right: 100px; /* width of image */
}
.nationality img {
position: absolute;
right: 0;
top: 0;
z-index: 1;
}
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<div data-role="fieldcontain" class="nationality">
<label id="Nationalitylbl">*Nationality:</label>
<input type="text" name="Nationality" id="Nationality" value="" style="width:100%" readonly/>
<img src="%bind(:13)" name="Ntlylkp" onclick="nationalityPopUp();"/>
</div>
Upvotes: 1
Reputation: 31739
Just decrease the width of the text filed and set the image width accordingly. Try with this code -
<div data-role="fieldcontain">
<label id="Nationalitylbl">*Nationality:</label>
<input type="text" name="Nationality" id="Nationality" value="" style="width:40%" readonly/>
<img src="%bind(:13)" width="200px" name="Ntlylkp" onclick="nationalityPopUp();"/>
</div>
Upvotes: 1