How do you get a jQueryUI button click to cause a page redirect?

11,295

Solution 1

You can use button() on links also

<a href="/search" class="button">My link</>
$(".button").button();

Solution 2

Try this:

jQuery("#do_search").button().click( function() {
    window.location.href = "/search";
});
Share:
11,295
Admin
Author by

Admin

Updated on July 23, 2022

Comments

  • Admin
    Admin almost 2 years

    If I define a jQuery UI button for a search feature:

    jQuery("#do_search").button();
    

    How do I get a click of this button to cause a page redirect to:

    /search