0

I have an excel-like table. The following picture represents a part of it (for clarification, I setted the text of the inputs to be their respective IDs):

enter image description here

There is a ContextMenu that is fired on right click (code here) in each one of the inputs.

Here is how I find all these input controls at once (I need to use this way because there are some more columns that I do not want to call the ContextMenu):

$('[id^="txtF_"],
   [id^="txtP_"], 
   [id^="txtT_"], 
   [id^="txtE_"], 
   [id^="txtM_"]').contextMenu({   ....

This works nice, however, if one of the items is disabled, the browser menu shows up instead. What can I do to fire the custom ContextMenu even if the input control is disabled?

Community
  • 1
  • 1
Guilherme
  • 5,143
  • 5
  • 39
  • 60
  • How are you disabling item? – Bikee Apr 17 '16 at 06:06
  • @BikashSinghMaharjan From asp.net, using the Enabled="false". The generated HTML on client looks like this: – Guilherme Apr 17 '16 at 06:27
  • 1
    the fact's that disabled elements don' t fire mouse events. Can you use asp.net's `Readonly = true` instead? Or try to bind the contextmenu in the parent element if you still want disabled textbox? – Bikee Apr 17 '16 at 07:10
  • @Bikee Yes, making the item readonly does the trick. Thank you. – Guilherme Apr 18 '16 at 16:36
  • However, I still want to find a way to maintain the item only disabled and still fire the context menu. It would be great If anyone want to contribute with an answer at least to explain why it is impossible to fire mouse events while the item is disabled. – Guilherme Apr 18 '16 at 16:38

0 Answers0