Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery disable post back on button Asp.net

I'm using Jquery UI and Autocomplete func.(Combobox) and I interested in this part.

$("<button>&nbsp;</button>")
                    .attr("tabIndex", -1)
                    .attr("title", "Show All Items")
                    .insertAfter(input)
                    .button({
                      icons: {
                        primary: "ui-icon-triangle-1-s"
                      },
                      text: false

My problem is when I use ASP.net, this button do PostBack, but I not need this because my list of items then gone. How can I override this behavior of button. Thanks

like image 744
amchoni Avatar asked Nov 02 '10 22:11

amchoni


1 Answers

Add an id to your button

$("#yourbutton").click(function(e) { e.preventDefault(); });
like image 81
Alex Avatar answered Oct 12 '22 22:10

Alex