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 8392099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:25:59+00:00 2026-06-09T19:25:59+00:00

I have written a jQuery function to bind mouseover event on mousedown to get

  • 0

I have written a jQuery function to bind mouseover event on mousedown to get the effect of click and drag to select td’s. I have 10 td’s in a table row. The problem with this code is, If I want to select td’s from 1 to 5 and I do a mousedown on td1 and mouseover till td5, td1 does not get selected (I am checking/unchecking a checkbox) instead it gets selected from td2 to td5. How do I fix it?
Any suggestion is appreciated.

Here is the code:

$("#custom-interval-tbl td").mousedown(function() {
     $('#custom-interval-tbl td').bind('mouseover',function(){
            if($(this).find('input:checkbox').is(':checked')) {
                       $(this).find('input:checkbox').attr("checked", "");
                       $(this).css({background:"white"});
            } else {
                       $(this).find('input:checkbox').attr("checked", "checked");
                       $(this).css({background:"#6D7B8D"});
            }
     });
});
  • 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-09T19:26:00+00:00Added an answer on June 9, 2026 at 7:26 pm

    When assigning the mouseover event, it is never activated by the one where the mouse is already down. (Since the mouse is ALREADY over, it will never be called.)

    You can force this to be called on the TD you already have selected.

    $("#custom-interval-tbl td").mousedown(function() {
         $('#custom-interval-tbl td').bind('mouseover',function(){
                if($(this).find('input:checkbox').is(':checked')) {
                           $(this).find('input:checkbox').attr("checked", "");
                           $(this).css({background:"white"});
                } else {
                           $(this).find('input:checkbox').attr("checked", "checked");
                           $(this).css({background:"#6D7B8D"});
                }
         });
         $(this).mouseover(); // This part will call the mouseover event on your clicked TD
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a working script like this: jQuery(document).ready(function(){ $('.video-thumb img').bind('mouseover',function(){ var new = $(this).attr('src').replace(/default.jpg/,'1.jpg');
Setup: I have written a jQuery function to update table cells of table_2, when
jQuery('img').bind('error',function(){ alert('hi'); jQuery(this).hide(); }); I have written this code but non available images are
I have written some simple jquery code : function Generate(result, counter) { $(#ArchivesContent).append( <table
I have written a simple jQuery.ajax function which loads a user control from the
I have written a form using the jQuery .post() function to post the data
Hi I am learning JQuery and I have written a small function where I
I have a modal dialog plugin written in jquery, that binds to the click
I have written a short jquery method that on the keypress event of a
I have written a very simple JQuery widget to handle fixed toolbars: (function($){ $.fn.stickytoolbar

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.