Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Document</title>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
  
  <script src="http://dwieeb.github.io/jquery-textrange/jquery-textrange.js"></script>
  <script type="text/javascript">
    $(function(){
      $("#tr").bind("keydown keypress mousemove", function() {
        console.log("??");
        var textRange = $(this).textrange('get');
        console.log(textRange.get(0));
        $('.res span').text(textRange.get(0));
      })
    });
  </script>d
</head>d
<body>dvsvsaav
  <div id="tr" contenteditable="true">
    this isd a tesctsda
  </div>
  <div class="res">Current position: <span></span></div>
</body>
</html>
Output

This bin was created anonymously and its free preview time has expired (learn why). — Get a free unrestricted account

Dismiss x
public
Bin info
anonymouspro
0viewers