This is my code:
$("#newGenreTxt").blur(function () {
$("#txtAddGenreContainer").slideUp();
});
I want to hide the text box if it loses its focus, but the problem is that I want to hide it if a user clicks anywhere but my button:
$("#addGenreFinal").click(function () {});
So If user clicks the addGenreFinal nothing happens and if it’s something else hide the textbox.
You can bind the
.slideUp()call to the a click event firing on the document object and then cancel the click if it is called on either theaddGenreFinalor thenewGenreTxtelements:Here is a jsfiddle: http://jsfiddle.net/jasper/qrSEn/