I am handling mousedown & oncontextmenu events to prevent text & image selection, right click and drag. The code is as follows -
<body oncontextmenu="return false;" onmousedown="event.preventDefault ? event.preventDefault() : event.returnValue = false">
<input type="text" name="testInput" id="testInput">
</body>
I guess the problem is it is also preventing the focus on input elements, as I am preventing default & returning false for onmousedown event, so it is not letting control switch to input focus, so I cant type any thing inside it. I tried to debug it by following code.
<script type="text/javascript">
$(function(){
$( "#testInput" ).on("focus",function(){
console.log("input focused");
});
});
</script>
When I removed the onmousedown attribute from body, it is giving me the desired message on cosole.
any help... Thanks in advance.