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

  • SEARCH
  • Home
  • 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 8766149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:28:43+00:00 2026-06-13T16:28:43+00:00

I have the following javascript, I don’t want this mousedown function to fire if

  • 0

I have the following javascript, I don’t want this mousedown function to fire if the user is clicking on a delete div inside the .field_trip_mini_div. The delete div id is ‘delete’. What code should I add so the mouse down function does not procede if the user clicked on the delete div? I tried changing the first line to

$(".field_trip_mini_div :not('#delete')").live({  

But that didn’t work. Is there a way I could stop it on the second line of code?

$(".field_trip_mini_div").live({  
    mousedown: function(){     
    $.ajax({
        type: "POST",
        url: "/field_trips/"+selected_field_trip_id+"/reload_div",
        data: {id: selected_field_trip_id},
        success: function(response)
           {
            $('#selected_fieldTrip_div').html(response);
           }
        });
});

Edit: I used # originally, thank you for the answers but it was a Stack Overflow input error.

  • 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-13T16:28:45+00:00Added an answer on June 13, 2026 at 4:28 pm

    Is delete an element inside field_trip_mini_div? If so you can check the id of the target of the clicked element using e.target:

    $(".field_trip_mini_div").live({  
        mousedown: function(e){    
          if ($(e.target).attr("id")!= "delete") // This line right here
          {
            $.ajax({
                type: "POST",
                url: "/field_trips/"+selected_field_trip_id+"/reload_div",
                data: {id: selected_field_trip_id},
                success: function(response)
                   {
                    $('#selected_fieldTrip_div').html(response);
                   }
                });
          }
      });
    

    Some info on events and the event object: http://www.w3schools.com/jsref/dom_obj_event.asp

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following Javascript/jQuery function: function addEventHandler(){ $(div).mouseenter(function() { $(this).html(Over); }).mouseleave(function() { $(this).html(Out);
I have the following javascript code inside index.php: $(function () { $('.checkall').click(function () {
I have the following Javascript code that works perfectly: $(document).ready(function() { $(#Select1).setDefault(); $(#Select2).setDefault(); $(#Select3).setDefault();
I have the following javascript : var MyObject = (function() { function Setup(args) {
I have the following in javascript: var entriesString = ''; $$('select[id=shopId]').each(function(elem, i){ shops[i] =
I have the following javascript code found also in this fiddle: http://jsfiddle.net/periklis/k4u4c/ <button id
I have the following simple javascript code, which handles the Return Key, I don't
Consider the following Javascript function (1): function setData(domElement) { domElement.myDataProperty = { 'suppose': 'this',
I have the following Fancybox declarations in my page: <script type=text/javascript> $(document).ready(function() { $(.fancybox).fancybox().hover(function()
I have the following JavaScript (I'm using jQuery): function language(language) { var text =

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.