Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link
URL Rewriter Bot
URL Rewriter Bot

This code works in firefox:

document.oncontextmenu=disableclick; function disableclick(event) { event.preventDefault(); alert("Context Menu Disabled"); return false; } 

http://jsfiddle.net/zumk5cta/1/

Update

contextmenu event won't work for disabled elements in firefox, it's a firefox behavior as explained well herehere

As a solution to your problem, I picked up the idea given by @Endy E@Endy E in his response herehere:

html

<span class="inputWrapper"> <input type="text" disabled /> <div class="mouseEventTarget"></div> </span> 

css

.inputWrapper{ position:relative; } .mouseEventTarget{ position:absolute; left:0; right:0; top:0; bottom:0; cursor: text } 

javascript

$(document).on('contextmenu', 'input:disabled + .mouseEventTarget',function(e){ return false; }); 

fiddle

This code works in firefox:

document.oncontextmenu=disableclick; function disableclick(event) { event.preventDefault(); alert("Context Menu Disabled"); return false; } 

http://jsfiddle.net/zumk5cta/1/

Update

contextmenu event won't work for disabled elements in firefox, it's a firefox behavior as explained well here

As a solution to your problem, I picked up the idea given by @Endy E in his response here:

html

<span class="inputWrapper"> <input type="text" disabled /> <div class="mouseEventTarget"></div> </span> 

css

.inputWrapper{ position:relative; } .mouseEventTarget{ position:absolute; left:0; right:0; top:0; bottom:0; cursor: text } 

javascript

$(document).on('contextmenu', 'input:disabled + .mouseEventTarget',function(e){ return false; }); 

fiddle

This code works in firefox:

document.oncontextmenu=disableclick; function disableclick(event) { event.preventDefault(); alert("Context Menu Disabled"); return false; } 

http://jsfiddle.net/zumk5cta/1/

Update

contextmenu event won't work for disabled elements in firefox, it's a firefox behavior as explained well here

As a solution to your problem, I picked up the idea given by @Endy E in his response here:

html

<span class="inputWrapper"> <input type="text" disabled /> <div class="mouseEventTarget"></div> </span> 

css

.inputWrapper{ position:relative; } .mouseEventTarget{ position:absolute; left:0; right:0; top:0; bottom:0; cursor: text } 

javascript

$(document).on('contextmenu', 'input:disabled + .mouseEventTarget',function(e){ return false; }); 

fiddle

Bounty Awarded with 25 reputation awarded by CommunityBot
added 804 characters in body
Source Link
Fares M.
  • 1.5k
  • 1
  • 17
  • 18

This code works in firefox:

document.oncontextmenu=disableclick; function disableclick(event) { event.preventDefault(); alert("Context Menu Disabled"); return false; } 

http://jsfiddle.net/zumk5cta/1/

Update   

contextmenu event won't work for disabled elements in firefox, it's a firefox behavior as explained well here

As a solution to your problem, I picked up the idea given by @Endy E in his response here:

html

<span class="inputWrapper"> <input type="text" disabled /> <div class="mouseEventTarget"></div> </span> 

css

.inputWrapper{ position:relative; } .mouseEventTarget{ position:absolute; left:0; right:0; top:0; bottom:0; cursor: text } 

javascript

$(document).on('contextmenu', 'input:disabled + .mouseEventTarget',function(e){ return false; }); 

fiddle

This code works in firefox:

document.oncontextmenu=disableclick; function disableclick(event) { event.preventDefault(); alert("Context Menu Disabled"); return false; } 

http://jsfiddle.net/zumk5cta/1/

Update  contextmenu event won't work for disabled elements in firefox, it's a firefox behavior as explained well here

This code works in firefox:

document.oncontextmenu=disableclick; function disableclick(event) { event.preventDefault(); alert("Context Menu Disabled"); return false; } 

http://jsfiddle.net/zumk5cta/1/

Update 

contextmenu event won't work for disabled elements in firefox, it's a firefox behavior as explained well here

As a solution to your problem, I picked up the idea given by @Endy E in his response here:

html

<span class="inputWrapper"> <input type="text" disabled /> <div class="mouseEventTarget"></div> </span> 

css

.inputWrapper{ position:relative; } .mouseEventTarget{ position:absolute; left:0; right:0; top:0; bottom:0; cursor: text } 

javascript

$(document).on('contextmenu', 'input:disabled + .mouseEventTarget',function(e){ return false; }); 

fiddle

added 213 characters in body
Source Link
Fares M.
  • 1.5k
  • 1
  • 17
  • 18

This code works in firefox:

document.oncontextmenu=disableclick; function disableclick(event) { event.preventDefault(); alert("Context Menu Disabled"); return false; } 

http://jsfiddle.net/zumk5cta/1/

Update contextmenu event won't work for disabled elements in firefox, it's a firefox behavior as explained well here

This code works in firefox:

document.oncontextmenu=disableclick; function disableclick(event) { event.preventDefault(); alert("Context Menu Disabled"); return false; } 

http://jsfiddle.net/zumk5cta/1/

This code works in firefox:

document.oncontextmenu=disableclick; function disableclick(event) { event.preventDefault(); alert("Context Menu Disabled"); return false; } 

http://jsfiddle.net/zumk5cta/1/

Update contextmenu event won't work for disabled elements in firefox, it's a firefox behavior as explained well here

Source Link
Fares M.
  • 1.5k
  • 1
  • 17
  • 18
Loading