<input type="text" id="nameId" value="Given Name"/>
<script type="text/javascript">
$(function(){
$("#nameId").on("keydown", function(e) {
if (($(this).get(0).selectionStart == 0 && (e.keyCode < 35 || e.keyCode > 40))
|| ($(this).get(0).selectionStart == 1 && e.keyCode == 8)) {
return false;
}
});
$("#nameId").bind("contextmenu", function(e) {
e.preventDefault();
});
});
</script>
<script type="text/javascript">
$(function(){
$("#nameId").on("keydown", function(e) {
if (($(this).get(0).selectionStart == 0 && (e.keyCode < 35 || e.keyCode > 40))
|| ($(this).get(0).selectionStart == 1 && e.keyCode == 8)) {
return false;
}
});
$("#nameId").bind("contextmenu", function(e) {
e.preventDefault();
});
});
</script>
No comments:
Post a Comment