Skip to content

Instantly share code, notes, and snippets.

View pookie13's full-sized avatar

Piyush Gupta pookie13

View GitHub Profile
<!DOCTYPE html>
<html ng-app="" ng-controller="myCtrl">
<body>
<input value="sample input value" ng-click="getCursorPos($event)" ng-keyup="getCursorPos($event)" id="searchTxt" type="text" />
<button ng-click="showAlert()">
<div> Cursor Position : <b ng-bind="pos"></b></div>
<script>
function myCtrl($scope) {
$scope.pos = document.getElementById('searchTxt').value.length ;
$scope.cursorPosVal = -1;