$(document).ready(function () { $("input[id$='SearchBtn']").click(function () { if ($(".dangerbox") == undefined || $(".dangerbox").html() == undefined || $(".dangerbox").html() == '') { return window.location.href = "/Search.aspx?keyword=" + encodeURI($(":text[id$='Keyword']").val()), !1 } else { LoginIn(); return false; } }) });