Using jsPlumb to Access an Element After a "Mouseup" Event has Completed

$(document).on('mouseup', '.agent-wrapper', function(info){
  console.log(info);    // Everything is working fine
  console.log(this);    
});

.agent-wrapper represents an element-wrapper for all jsPlumb objects.

$(document).on('mouseup', 'div.node', function(info){
  console.log(info);   
  console.log(this);    
});

How can I retrieve the element-node inside the jsPlumb-wrapper for the "mouseup" event?

HTML

<div id="flume-AGENT-1" class="agent-wrapper" index="0">
  <div data-nodetype="source" class="w node jsplumb-draggable jsplumb-droppable">
    Element 1
    <div class="ep"></div>
  </div>
  <div data-nodetype="source" class="w node jsplumb-draggable jsplumb-droppable">
    Element 2
    <div class="ep"></div>
  </div>
</div>

When I press down on the first element and release on the second, I am unable to get the target element in JavaScript. ... How do I obtain the event.target?

It seems like jsPlumb unbinds all events related to elements within its wrapper ... but I need to access this element. Any suggestions?

Answer №1

It appears that the ".node" divs have been linked to jsPlumb using the source or target methods, which will take precedence over jQuery's mouse-up and mouse-down functions. This is because jsPlumb manages connection creation for those specific ".node" divs during mouse events.

Therefore, you cannot simultaneously link both jsPlumb and jQuery events to the same elements. Instead, you should handle these events on a parent node, similar to how it was done with ".agent-wrapper".

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Learn the process of fetching checkbox values using JavaScript with this snippet

Is it possible to retrieve the name of the selected checkbox values/labels from the following code: <input id ="abc" value="abeexch" type ="checkbox"> <input id ="nam" value="suns" type ="checkbox"> If a checkbox is selected, how can I obtain ...

Transmit Array of Preferred Values to Controller in MVC Framework

After setting up a view with a search box and buttons labeled "Add" (btn-default) and "Edit" (breadcrumb), I encountered an issue when attempting to pass selected values from the search box to another controller upon clicking the Edit button. Unfortunately ...

Is it possible to create a compound editor within a cell in SlickGrid that contains two date fields

Currently, I am implementing SlickGrid with jQuery and I am interested in incorporating a compound editor within a cell similar to example 3a mentioned here. However, instead of two text fields, I would like to have two date fields. Although Example 3 dem ...

Spring Boot fails to recognize path variable data sent from Angular

When working with Angular 7, I encountered a situation where I needed to pass a value from the service class of Angular. Here is how I achieved it: executeHelloWorldBeanServiceWithPathVariable(name){ console.log("name coming from here"+name); retu ...

Using jQuery sortable with the overflow property set to hidden to sort items between two lists

I need help with a jQuery sortable feature where I have two lists and can move items between them: $( '#productsList, #orderList' ) .sortable({connectWith: '.containerDiv'}) .disableSelection(); My issue arises when I try to implement ...

Utilizing static methods to interact with page elements

I am currently utilizing an ASP.NET datepicker and triggering a static event when a user selects a date using jQuery code like the following: <script> $(document).ready(function () { $("#datepicker").datepicker({ onSelect: f ...

(Django) Cross-Site Request Forgery protection successfully implemented for AJAX requests on Chrome, encountering issues on

I've encountered an issue with my (Django) CSRF verification not working in Firefox, although it works perfectly fine in Chrome. I am looking for insights to understand why this discrepancy exists and how I can rectify it. The following code segment ...

Consecutive POST requests in Angular 4

Can you assist me with making sequential (synchronous) http POST calls that wait for the response from each call? generateDoc(project, Item, language, isDOCXFormat) : Observable<any> { return this.http.post(this.sessionStorageService.retriev ...

The oncanplaythrough event is not functioning properly in Internet Explorer

I am facing an issue where the beep sound trigger upon receiving an API response works perfectly in Chrome and Firefox browsers, but unfortunately, it does not work in Internet Explorer. if ($scope.totalQueueList) { var audio = new Audio(); audio.s ...

Ways to adjust the width of the Dialog box in Jquery UI to 60% of the window size

Currently, I am utilizing Jquery UI for a pop-up feature that displays a table populated through an Ajax call. The script implementation is as follows: <script> $(function() { $( "#dialog" ).dialog({ autoOpen: false, show: { ...

How can I efficiently utilize the date picker feature in Angular JS for a smooth user experience?

I am new to AngularJS and attempting to implement a date picker. I initially tried using a basic jQuery UI date picker, but it did not function as expected. Can someone please provide me with some code that demonstrates the simplest way to achieve this in ...

Discovering the window.scrollTop, ScrollY, or any other distance value while utilizing CSS scroll snap can be achieved by following these

I am currently utilizing css scroll snap for smooth scrolling through sections that are 100vh in height. The functionality of the scroll snap is quite impressive. However, I need to find a way to determine the exact distance the user has scrolled down the ...

Vue is removing a DOM node during the created lifecycle hook to set up a component

I am currently working on understanding the issue with this example that is not behaving as expected. My goal is to initialize my ContentView using the server-side rendered HTML in the DOM. I plan to check if init__main-content exists and then initialize t ...

Toggle a MutationObserver using a button to stop and start monitoring for changes

Is there a way to connect a MutationObserver and disconnect it using the same button? I know how to do each separately, but I want to use just one button. How can I achieve this? Apologies for my poor English. var target = document.getElementsByClassNa ...

Adding up rows and columns using HTML

I've designed an HTML table to function as a spreadsheet, with the goal of being able to total up rows and display the sum in a cell labeled "Total." The same calculation should be applied to columns as well, with totals displayed in the last column c ...

Trouble with formatting credit card numbers in Vue.js

My payment gateway component includes a feature where selecting credit card triggers the _formatCreditCard method to format the credit card number like this: 4444 2442 4342 3434 This is the function in question: _formatCreditCard: function() { var n ...

The data visualization tool Highchart is struggling to load

As I try to integrate highcharts into my website, I encounter an unexpected error stating TypeError: $(...).highcharts is not a function. Below is the code snippet in question: @scripts = {<script src="@routes.Assets.at("javascripts/tracknplan.js")" ty ...

I am struggling with clicking on Bootstrap's pagination using AngularJS

I'm still getting the hang of Angularjs. I managed to set up a pagination system, but for some reason, I can't seem to interact with it when I run my project. Take a look at this screenshot that illustrates my issue: https://drive.google.com/fil ...

Tips for accessing data from a local JSON file in your React JS + Typescript application

I'm currently attempting to read a local JSON file within a ReactJS + Typescript office add-in app. To achieve this, I created a typings.d.ts file in the src directory with the following content. declare module "*.json" { const value: any; ex ...

Unable to set DIV to 'inline-block' or none based on checkbox selection

Despite reviewing multiple examples, I am still struggling to make this DIV visible and hidden by clicking a checkbox. Can someone please review my JavaScript code? <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Conten ...