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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:04:54+00:00 2026-05-22T16:04:54+00:00

If we bind a click event to a link as $(linkSelector).click(function(){ … }); then

  • 0

If we bind a click event to a link as

$("linkSelector").click(function(){ ... });

then we can easily also force executing this event handler even though user didn’t click the link.

$("linkSelector").click(function() { ... }).click();

But in my case I’m using jQuery Slider widget which has the slide event to which an event handler can be bound. I wonder how can we force execute its events programatically?

I’ve tried following but none of them works:

$("sliderSelector").slider({ slide: function(){ ... } }).slide();
$("sliderSelector").slider({ slide: function(){ ... } }).slider("slide");
$("sliderSelector").slider({ slide: function(){ ... } }).trigger("slide");

I know I could use a named function instead of an anonymous one, but I don’t consider that a solution because I can call the function with whatever arguments I want while triggering slide event would provide correct values as set by the slider.

  • 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-05-22T16:04:55+00:00Added an answer on May 22, 2026 at 4:04 pm

    Solution

    This is the resulting code that actually triggers such event handler:

    var s = $("sliderSelector").slider({ slide: function(evt, ui){ ... } });
    s.slider("option", "slide").call(s, null, { values: s.slider("values") });
    

    Make sure you provide those function parameters that you actually use in your event handler. In my case where I’m using a range slider I need ui.values parameter, so I’m creating such an object so my handler won’t break.

    It’s not a nice solution since I have to call .slider() function multiple times but it’s the safest way of preventing the use of magic values.

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

Sidebar

Related Questions

When I bind a function to a link with $('a#link_id').click() and then I click
I bind to a link (by using the .live() function of jQuery) click event
I am using this code to display a grid $('#table1 tr').bind('click', shows); function shows()
I have a situation where I need to bind a click event to an
Using jQuery, how do you bind a click event to a table cell (below,
Consider the following code, in theory the click event should bind to each element
$(b).bind(contextmenu,function(e){ thiselementselected = e.target $(#add).bind(click,function(e){ thiselementselected.css(font-color, red); return false }); $(#remove).bind(click,function(e){ thiselementselected.css(font-color, ); return
If I have following in jQuery $(#someId).add(#someOtherId).bind(click, function(e) {... I get the click bound
$(#table_id).click(function(e) { var row = jQuery(e.target || e.srcElement).parent(); $(#table_id).bind('click', loaddata); name= row.attr(id); }); loaddata
var somestring = mary(3) apple(2) sky(1); $(#removelaststring).unbind(click).bind(click,function(e){ somestring = somestring.replace(/\(\d+\)*$/, ) alert(somestring); }); i

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.