I have modal window, this modal window has events: $(document).on('click', '#TaskOutcomesTab .has-attachments-image', function(){  After close popup, I want to clear this handler. I've found success in solution, but I want to make it more general         $(document).off(&quot;click&quot;, &quot;#task-details .has-attachments-image&quot;);         $(document).off(&quot;click&quot;, &quot;#task-details .no-attachments-image&quot;);         $(document).off(&quot;click&quot;, &quot;#TaskOutcomesTab .has-attachments-image&quot;);         $(document).off(&quot;click&quot;, &quot;#TaskOutcomesTab .no-attachments-image&quot;);  I wanna something like that: $(document).off(&quot;click&quot;)  or $(document).off(&quot;click&quot;, &quot;.has-attachments-image&quot;)
5844
I have an input type="image". This acts like the cell notes in Microsoft Excel. If someone enters a number into the text box that this input-image is paired with, I setup an event handler for the input-image. Then when the user clicks the image, they get a little popup to add some notes to the data.  My problem is that when a user enters a zero into the text box, I need to disable the input-image's event handler. I have tried the following, but to no avail.  $('#myimage').click(function { return false; });
62447
How can I prevent ajax failure popups and instead route the failure to the console log instead?  Is this something I can do with Drupals implementation of jQuery?
37853
Is there a function like document.getElementById("FirstDiv").clear()?
107565
How would I know through a script when the switch to edit mode happens? I need it for modal operator.  I was thinking on listening for 'TAB' event and checking obj.mode, but I hope there is a better way, for reasons like changed edit-mode shortcut or switching to edit-mode by script.
24463
Question: How to pop-up alert to a user when he/she navigate away from page without saving the Records in custom visual force page?  Details:  I have a custom visual force page i.e. "My Members" that have the following code:  &lt;apex:page Controller="MyMember" &gt; &lt;script&gt;  function mytest() {  if (!confirm('Are you sure to naviagte without saving Records?')) {   }  else {return true;} }  window.onbeforeunload = mytest(); &lt;/script&gt; &lt;apex:form id="form"&gt;    &lt;apex:pageblock title="Member List" &gt;  &lt;apex:pageBlocktable value="{!CheckSelectedList}" var="memLst" &gt; &lt;apex:column title="Select" &gt; &lt;apex:inputCheckbox value="{!memLst.checked}" &gt;&lt;/apex:inputcheckbox&gt; &lt;/apex:column&gt; &lt;apex:column headerValue="Name" &gt; &lt;apex:actionRegion &gt; &lt;apex:outputField value="{!memLst.KeepSelected.Name}" &gt; &lt;apex:inlineEditSupport event="ondblClick" showOnEdit="btnSave,btnCancel" hideOnEdit="btnAddSession" /&gt; &lt;/apex:outputField&gt; &lt;/apex:actionRegion&gt; &lt;/apex:column&gt;  &lt;/apex:pageBlocktable&gt;  &lt;apex:pageblockButtons&gt; &lt;apex:commandButton value="Save" action="{!save}" id="btnSave"  style="display:none" /&gt;  &lt;apex:commandButton value="Cancel" action="{!cancel}" id="btnCancel"  style="display:none" reRender="PanelId" /&gt; &lt;/apex:pageblockButtons&gt;   &lt;/apex:pageblock&gt; &lt;/apex:form&gt; &lt;/apex:page&gt;   In my VF Page, I have a in-line edit support enable.  The issue is:  Whenever, I want to alert user when they edit records and navigate without saving the record using JavaScript (Please see above the JavaScript code I was trying). It doesn't seem to be working. Am I missing anything? Is it possible to do this using only JavaScript in Customer Visual Force Page? Need: I want when user edit the Record and leave the page without saving my function will execute and show the pop-up message.   My thoughts:  I was also thinking to execute my JavaScript function by using apex class? Should it be possible? Or any other technique how to invoke popup when the user navigate without saving the Edit records?
103859
What's the easiest way to figure out if a window is opened modally or not?  CLARIFICATION:  I open a window calling   myWindow.ShowDialog();   I have a footer with an "OK" &amp; "Cancel" button that I only want to show if the window is opened modally. Now I realize I can set a property by doing this:  myWindow.IsModal = true; myWindow.ShowDialog();   But I want the window itself to make that determination. I want to check in the Loaded event of the window whether or not it is modal.  UPDATE  The IsModal property doesn't actually exist in a WPF window. It's a property that I have created. ShowDialog() blocks the current thread.   I'm guessing I can determine if the Window is opened via ShowDialog() by checking if the current thread is blocked. How would I go about doing that?
6687
I would like to close some view windows that I opened accidentally.  See the image below:    Edit: another note: I tried searching for the solution, but only found things like "Join Area", which don't seem to work in this situation.
56164
Is there some setting in Windows where I can change the default behavior that causes the border and title of a modal dialogue box to flash like 6 or 7 times when I click on the parent window?  Simply focusing it would be plenty to let me know what I did was wrong.   I don't feel the need for all the sirens and bull horns and strobe lights to let me know I clicked in the wrong place.
90466
I created a custom theme (a sub-theme of  base theme).   I am loading a custom Javascript file (radix_sub.script.js) using the module libraries.yaml file like below:  style:   version: VERSION   css:     theme:       assets/css/radix_sub.style.css: {}   js:     '//cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js': { type: external }     '//stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js': { type: external }     assets/js/radix_sub.script.js: {}   dependencies:     - core/drupal     - core/jquery     - core/jquery.once     - core/drupalSettings   In that file, I want to register some JavaScript events (Bootstrap modal).  (function ($, Drupal) {    Drupal.behaviors.portfolio = {      attach: function (context) {        console.log('CONTEXT', context);        $('#portfolioModal', context).once('bootstrap-modal-shown', console.log('*** REGISTER SHOWN.BS.MODAL')).each(function () {         $(this).on('shown.bs.modal', function () {           console.log('SHOWN BS MODAL EVENT TRIGGERED');         });       });        $('#portfolioModal', context).once('bootstrap-modal-hidden', console.log('*** REGISTER HIDDEN.BS.MODAL')).each(function () {         $(this).on('hidden.bs.modal', function () {           console.log('HIDDEN BS MODAL EVENT TRIGGERED');         });       });     }   } }(jQuery, Drupal));   It works. I see both SHOWN BS MODAL EVENT TRIGGERED and HIDDEN BS MODAL EVENT TRIGGERED logs when I show/hide the modal.  First, am I doing that the correct way?  This is what my developer console looks like when I load my page.        This happens only when I am logged in (as admin). When I am anon, I see the REGISTER logs only once but here my code seems to be executed 11 times.  Is this normal behavior? And/or why is it doing that?
10898
I want to start a modal operator by clicking a button in a panel in the properties region. It should then stop when I click somewhere in the 3D viewport. I want to execute some code when I start and finish the operator (see the code below). I tried modifiyng the modal operator template with an execute method to start the modal operator. But the now the context.space_data.type is always &quot;PROPERTIES&quot; because that's where the panel is located, I guess. Is this a bad way of doing what I want? class MY_OPERATOR_OT_click_on_3dview(bpy.types.Operator):          bl_idname = &quot;mesh.click_on_3dview&quot;     bl_label = &quot;Click on 3D&quot;      def modal(self, context, event):                  if context.space_data.type != 'VIEW_3D':             return {'PASS_THROUGH'}                  if event.type in {'MIDDLEMOUSE', 'WHEELUPMOUSE', 'WHEELDOWNMOUSE'}:             # allow navigation             return {'PASS_THROUGH'}         elif event.type == 'LEFTMOUSE':             # DO ALL THE POST-SELECT STUFF             return {'FINISHED'}         elif event.type in {'RIGHTMOUSE', 'ESC'}:             return {'CANCELLED'}          return {'RUNNING_MODAL'}      def execute(self, context):         # DO ALL THE SETUP STUFF           context.window_manager.modal_handler_add(self)              return {'RUNNING_MODAL'}            def cancel(self, context):         print(&quot;CANCEL???&quot;)
11389
I would like to find a different solution to closing these windows without having to do the click and drag.
72526
When editing a profile’s “About me” section, or a tag wiki, and hitting CtrlG, or clicking the “Image” button from the formatting bar to insert an image, the Imgur upload modal dialog will appear. The same modal will also appear when uploading a profile picture. This is different from questions and answers where an uploader overlay bar (technically referred to as inline-dialog) appears. This modal dialog has an × button for closing, but it does nothing when clicked. I also can’t try tabbing to it and hit Enter, because it’s a regular &lt;div&gt; with no tabindex attribute, so it’s not tabbable and not an interactive element. (After manually inserting a tabindex and pressing Enter, it also did nothing, of course.)  There are no errors produced in the console of any browser. It doesn’t even seem to have any event listener bound to it. Pressing the Esc key or clicking outside of the modal dialog will dismiss the dialog, but the × button is currently useless. An obvious possible  would be to unify all Imgur upload dialogs to the way they appear on questions and answers, as an inline-dialog. But for the profile picture uploader, this dialog doesn’t have an obvious alternative, so in this instance, it’s necessary to redesign the close button so that it acts as a normal button (interactive element, tabbable) and closes the modal popup.  Related   and  — showing this modal in action; closing it used to work.  — for an older dialog design.
6707
I have a console application that contains quite a lot of threads.  There are threads that monitor certain conditions and terminate the program if they are true.  This termination can happen at any time.  I need an event that can be triggered when the program is closing so that I can cleanup all of the other threads and close all file handles and connections properly.  I'm not sure if there is one already built into the .NET framework, so I'm asking before I write my own.  I was wondering if there was an event along the lines of:  MyConsoleProgram.OnExit += CleanupBeforeExit;
5826
I am using the  plugin  I am looking for way to refresh the page when in some circumstances when the dialog is closed.  Is there a way to capture a close event from the dialog?  I know I can run code when the close button is clicked but that doesn't cover the user closing with escape or the x in the top right corner.
19928
How can I exit the JavaScript script much like PHP's exit or die? I know it's not the best programming practice but I need to.
83075
I want to be able to close an alert box automatically using Javascript after a certain amount of time or on a specific event (i.e. onkeypress).  From my research, it doesn't look like that's possible with the built-in alert() function.  Is there a way to override it and have control over the dialog box that it opens?  Also, I don't want an override that shows a hidden div as the alert.  I need an actual dialog box.
20484
Recently I've been doing a lot of modal window pop-ups and what not, for which I used jQuery. The method that I used to create the new elements on the page has overwhelmingly been along the lines of:   $("&lt;div&gt;&lt;/div&gt;");   However, I'm getting the feeling that this isn't the best or the most efficient method of doing this. What is the best way to create elements in jQuery from a performance perspective?   has the benchmarks to the suggestions below.