javascript - How to fix UI issue when Cursor set to last position of textbox in chrome -


i have big problem tried find fix didn't work posting here. visit link see ui issue present in chrome. ideally blue colored textbox how ui should like. when keep on adding elements , size grows textbox doesn't show last text instead shows data non blue colored textboxes though caret position @ last of textbox. using code.

<!doctype html>  <html lang="en"> <head> <meta charset="utf-8" /> <title>jquery ui autocomplete - multiple values</title> <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />  <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <link rel="stylesheet" href="/resources/demos/style.css" /> <script> $(function() { var availabletags = [     "actionscript",     "applescript",     "asp",     "basic",     "c",     "c++",     "clojure",     "cobol",     "coldfusion",     "erlang",     "fortran",     "groovy",     "haskell",     "java",     "javascript",     "lisp",     "perl",     "php",     "python",     "ruby",     "scala",     "scheme" ]; function split( val ) {     return val.split( /,\s*/ ); } function extractlast( term ) {     return split( term ).pop(); }  $( "#tags" )     // don't navigate away field on tab when selecting item     .bind( "keydown", function( event ) {         if ( event.keycode === $.ui.keycode.tab &&                 $( ).data( "ui-autocomplete" ).menu.active ) {             event.preventdefault();         }     })     .autocomplete({         minlength: 0,         source: function( request, response ) {             // delegate autocomplete, extract last term             response( $.ui.autocomplete.filter(                 availabletags, 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( ", " );             focuscampo(this.id);             return false;         }     }); });  function focuscampo(id) { var inputfield = document.getelementbyid(id); if (inputfield != null && inputfield.value.length != 0) {     if (inputfield.createtextrange) {         var fieldrange = inputfield.createtextrange();         fieldrange.movestart('character', inputfield.value.length);         fieldrange.collapse();         fieldrange.select();     } else if (inputfield.selectionstart || inputfield.selectionstart == '0') {         var elemlen = inputfield.value.length;         inputfield.selectionstart = elemlen;         inputfield.selectionend = elemlen;         inputfield.focus();     } } else {     inputfield.focus(); } } </script> </head> <body>  <div class="ui-widget"> <label for="tags">tag programming languages: </label> <input id="tags" size="50" /> </div> </body> </html> 

js fiddle same

any sort of appreciated. thanks.

have here: set mouse focus , move cursor end of input using jquery

seems moving text caret selection , focus works when focusing (in case input doesn't loose it), in focuscampo function before focus call add:

 inputfield.blur(); 

here's modified fiddle , seems working: http://jsfiddle.net/59yal/25/


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -