jquery - asp textbox Placeholder and autocomplete doesnt work together in IE8 -


i have asp texbox , has placeholder , jquery autocomplete functionality. both working fine in chrome in ie8 placeholder not working. in order make work place watermark placeholder in jquery watermark displaying autocomplete not working. issue in ie8:

<asp:textbox id="txtlocation" runat="server" cssclass="frmhometxtlocation" placeholder="locations"                             onblur="javascript:formatlocation();"></asp:textbox>           $("#txtlocation")         // don't navigate away field on tab when selecting item           .bind("keydown", function (event) {               if (event.keycode === $.ui.keycode.tab &&                 $(this).autocomplete("instance").menu.active) {                   event.preventdefault();               }           })            .autocomplete({               delay: 0,               minlength: 1,               source: function (request, response) {                   // delegate autocomplete, extract last term                   response($.ui.autocomplete.filter(                 locations, extractlast(request.term)));               },               focus: function () {                   // prevent value inserted on focus                   return false;               },               select: function (event, ui) {                   var terms = split(this.value);                   // remove current input                   terms.pop();                   // add selected item                   terms.push(ui.item.value);                   // add placeholder comma-and-space @ end                   terms.push("");                   this.value = terms.join(", ");                   return false;               }           });     }); 

i doing mistake here , not including watermark.min.js. use tooltip watermark. working perfectly. here correct code:

<script src="scripts/jquery-1.10.2.js" type="text/javascript"></script> <script src="scripts/jquery-ui1.11.4.js" type="text/javascript"></script> <script src="scripts/watermark.min.js" type="text/javascript"></script> <script type="text/javascript"> $(function () {         var locations = ["anywhere", "gurgaon", "delhi", "noida","chennai"];         function split(val) {             return val.split(/,\s*/);         }         function extractlast(term) {             return split(term).pop();         }          $("#txtlocation")         // don't navigate away field on tab when selecting item         .watermark(         {          })           .bind("keydown", function (event) {               if (event.keycode === $.ui.keycode.tab &&                 $(this).autocomplete("instance").menu.active) {                   event.preventdefault();               }           })            .autocomplete({               delay: 0,               minlength: 1,               source: function (request, response) {                   // delegate autocomplete, extract last                    response($.ui.autocomplete.filter(                 locations, extractlast(request.term)));               },               focus: function () {                   // prevent value inserted on focus                   return false;               },               select: function (event, ui) {                   var terms = split(this.value);                   // remove current input                   terms.pop();                   // add selected item                   terms.push(ui.item.value);                   // add placeholder comma-and-space @ end                   terms.push("");                   this.value = terms.join(", ");                   return false;               }           });     });  });  </script> <asp:textbox id="txtlocation" runat="server" cssclass="frmhometxtlocation" placeholder="locations" tooltip="locations"                             onblur="javascript:formatlocation();"></asp:textbox> 

Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -