Facing issues with Jquery Mobile and jquery ui autcomplete feature
This is the way i am using autocomplete for my jquery mobile application which is using jquery ui
- <input type="text" id="iamat" name="iamat" onkeypress="return nospecialCharacters(event)" required/>
- <div class="autoSearch_result_Wrap" id="iamatsearch" name="iamatsearch"></div>
-
-
- $("#iamat").autocomplete(
- {
- source: function(request, response)
- {
- var iamat = $.trim($("#iamat").val());
- $.ajax(
- {
- success: function(data)
- {
- var result = [];
- jsondata = data;
- for (var i = 0; i < data.length; i++)
- {
- result.push(data[i].vendor_name)
- }
- response(result);
- },
- error: function(x, t, m)
- {
- if (t === "timeout")
- {
- alert("got timeout , please try again");
- }
- else
- {}
- }
- });
-
- },
- minLength: 2,
- appendTo: "#iamatsearch",
- select: function(event, ui)
- {
- $("#iamat").val(ui.item.label);
- $("#tablenum").focus();
- return false;
- }
- });
There are two issues i am facing is that
1 . Sometimes the autosuggested text displayed is not cleared .
2 . Sometimes the selected text remains for some seconds on top left of the page during page navigation
Could you please let me know how to resolve ??
anyway not sure about the css ,
.autoSearch_result_Wrap{
width: 100%;
float: left;
/*position: absolute;*/
position:relative;
margin-top: -9px;
z-index: 9;
}
.autoSearch_result_Wrap ul{
width:100%;
float:left;
background: #f6f6f6;
width: 100%;
list-style: none;
padding: 0px;
margin: 0px;
-webkit-box-shadow: 0px 1px 10px 0px rgba(0, 0, 0, 0.22);
box-shadow: 0px 1px 10px 0px rgba(0, 0, 0, 0.22);
}
.autoSearch_result_Wrap ul li{
list-style:none;
margin:0px;
padding: 15px;
border-bottom: 1px solid #eee;
cursor:pointer;
}
.autoSearch_result_Wrap ul li:last-child{
border-bottom: 0px;
}
.autoSearch_result_Wrap ul li:hover{
background:#d03e43;
color:#fff;
border-bottom: 1px solid #d03e43;
}