Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><a href="http://jsfiddle.net/JXVcm/10/" rel="nofollow">Try this</a>.</p> <p>HTML:</p> <pre><code>&lt;label&gt;email:&lt;/label&gt; &lt;input id="tb_Email" length="30"&gt;&lt;/input&gt; </code></pre> <p>JS:</p> <pre><code>$(document).ready(function (event) { $(document).delegate("#tb_Email", "keyup", function (event) { if (event.which === 188) { var cleanedValue = $(this).val().replace(",", "."); $(this).val(cleanedValue); $(this).caretToEnd(); } }); //Set caret position easily in jQuery (function ($) { // Behind the scenes method deals with browser // idiosyncrasies and such $.caretTo = function (el, index) { if (el.createTextRange) { var range = el.createTextRange(); range.move("character", index); range.select(); } else if (el.selectionStart != null) { el.focus(); el.setSelectionRange(index, index); } }; // The following methods are queued under fx for more // flexibility when combining with $.fn.delay() and // jQuery effects. // Set caret to a particular index $.fn.caretTo = function (index, offset) { return this.queue(function (next) { if (isNaN(index)) { var i = $(this).val().indexOf(index); if (offset === true) { i += index.length; } else if (offset) { i += offset; } $.caretTo(this, i); } else { $.caretTo(this, index); } next(); }); }; // Set caret to beginning of an element $.fn.caretToStart = function () { return this.caretTo(0); }; // Set caret to the end of an element $.fn.caretToEnd = function () { return this.queue(function (next) { $.caretTo(this, $(this).val().length); next(); }); }; }(jQuery)); </code></pre> <p>I included small plugin code for position.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload