Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7710879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:14:00+00:00 2026-06-01T01:14:00+00:00

Here is my code: $(document).ready(function(){ dropbox.addEventListener("dragenter", somethingHappens, false); }); function somethingHappens(evt) { // code

  • 0

Here is my code:

$(document).ready(function(){
dropbox.addEventListener("dragenter", somethingHappens, false);
});

function somethingHappens(evt) {
    // code here
}

How can I pass data to the somethingHappens() function when attaching the event listener? Is that possible? I was looking for something I could do like:

function somethingHappens(evt,dataItem1,dataItem2) {
    // code here, I need to use evt here
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T01:14:02+00:00Added an answer on June 1, 2026 at 1:14 am

    You can do it the old school way if you don’t mind using an anonymous function as handler:

    var data = { foo: 'bar' };
    
    dropbox.addEventListener("dragenter", function(evt) {
        somethingHappens.call(this, evt, data);
    }, false);
    
    function somethingHappens(evt, data) {
        console.log(data);
    }
    

    But I’m also pretty sure you can use jQuery events for this:

    $(dropbox).bind( 'dragenter', { foo: 'bar' }, somethingHappens );
    
    function somethingHappens(evt) {
        console.log(evt.data);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using tablesorter and tablesorter.pager. Here is my code: $(document).ready(function() { $("#peopletable") .tablesorter({ widthFixed:
Can i place html include inside Jquery? Here is the code: $(document).ready(function(){ $(.photo).hoverIntent(function() {
Here is my code: function currentCursPos(){ $(document).mousemove(function(e){ var pos= {"x":e.pageX,"y":e.pageY}; return pos }); }
Here is my code: $(document).ready(function(){ $('.classOne').mouseover(function(e) { alert($(e).attr('id')); }); }); Now, I know that
Here's my code: $(document).ready(function(){ var Bold=Yes! There is bold in the text above!!; var
Here's the code: $(document).ready(function(){ $(.menu ul li a).click( function(){ curpage = $(this).attr('href'); loadpage(curpage); });
Here's my code: $(document).ready(function () { var default_var = 2; var show_var = default_var;
here's my code: $(document).ready(function () { $('.flip1').click(function () { $('.panel1').slideToggle(slow); }); $('.flip2').click(function () {
using jquery-ui-map here is my code $(document).ready(function() {$('#map_canvas').gmap({ 'center': new google.maps.LatLng(3.162456,21.09375), 'zoom': 2, 'streetViewControl':
I have a webservice returning jsonp format. here's the code: $(document).ready(function(){ $.getJSON(http://api.tubeupdates.com/?method=get.status&lines=central,victoria&return=name&jsonp=?, function (result){

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.