HTML required readonly input in form

后端 未结 13 2120
执笔经年
执笔经年 2020-12-13 08:36

I\'m making a form. And on one input tag is an OnClick event handler, which is opening a popup, where you can choose some stuff, and then it autofi

13条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-13 09:25

    Based on answer @KanakSinghal but without blocked all keys and with blocked cut event

    $('.readonly').keydown(function(e) {
      if (e.keyCode === 8 || e.keyCode === 46)  // Backspace & del
        e.preventDefault();
    }).on('keypress paste cut', function(e) {
      e.preventDefault();
    });
    
    

    P.S. Somebody knows as cut event translate to copy event?

提交回复
热议问题