Hello,
I want to disable tab event from input box on form
for that i tried:

<script language="JavaScript">
    // disable tab event on form
    $(window).keydown(function(event){
        if(event.keyCode == 9 ) {
            alert("tab is clicked") // it alerts but execute get vanished quickly
          event.preventDefault();
          return false;
        }
      });
</script>

and

document.querySelector('input').addEventListener('keydown', function (e) {
    if (e.which == 9) {
        e.preventDefault();
    }
});

but still it is processing on above code.

is there any ither way?

You have to append the listener to the input:

$("input").keydown(function(event){
        if(event.keyCode == 9 ) {
          event.preventDefault();
          return false;
        }
      });
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.