5

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

2 Answers 2

3

Add an id to your button

$("#yourbutton").click(function(e) { e.preventDefault(); });
Sign up to request clarification or add additional context in comments.

Comments

2

give your button a click handler and return false and prevent default propagation

.click( function(event) { event.preventDefault(); return false; } );

tacked onto the end should give you the least of what you want.

The thing is that the button is being inserted inside a form. Any button inside a form causes the form to postback. That's default behavior for a browser, and is considered expected.

Does this help clarify why this is occuring on your asp.net application?

You may not need to return false, but I usually do.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.