The code snippet and the related issue can be found here on github
is the text area the root cause of the problem?
I have also tried using <div contenteditable> </div>
instead of <textarea></textarea>
EDIT: copying question here
<div id="caret"></div>
at line 25 in index.html
needs to be put on z-index: 2
in order to come between the background div and the front textarea
instead the caret comes after the front textarea at the bottom, even explicitly positioning the caret div doesn't make it move to the right place
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.7/angular-sanitize.min.js"></script>
<script type="text/javascript" src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" integrity="sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ==" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js" integrity="sha512-K1qjQ+NcF2TYO/eI3M6v8EiNYZfA95pQumfvcVrTHtwQVDG+aHRqLi/ETn2uB+1JqwYqVG3LIvdm9lj6imS/pQ==" crossorigin="anonymous"></script>
<link rel="stylesheet" href="http://raw.github.com/ishankhare07/syntax-highlighter/blob/gh-pages/static/css/index.css">
<script type="text/javascript" src="http://raw.github.com/ishankhare07/syntax-highlighter/blob/gh-pages/static/js/app.js"></script>
<div class="container top-offset" ng-controller="EntryController as highlighter">
<div class="row top-buffer">
<input placeholder="Enter filename with extension" ng-model="highlighter.filename" class="rounded-border col-md-6">
<div class="col-md-6 text-center">{{ highlighter.filename }}</div>
</div>
<div class="row top-buffer panel panel-default" id="code">
<div class="code highlight" id="background">
</div>
<textarea spellcheck="false" class="code panel-default" id="front" ng-change="highlighter.change()" ng-model="highlighter.code"></textarea>
<div id="caret">
</div>
</div>
</div>