Hi,
I have such a code block and when code founds an error attribute which is set to error, then it should prevent further execution, how can I prevent it from execution :
$(document).ready(function() {
$("#SendMessage").click(function(e) {
var elements = $("#contact-area input:text[error=error]").get();
for (var i = 0; i < elements.length; i++) {
if ($(elements[0]).attr("error") == "error") {
alert("error found");
// Stop execution of whole function
}
}
$("#loaderImage").show();
$("#statusMessage").text("Sending, Please wait...");
window.setTimeout(function() { PageMethods.SendMessage(new Message().fullContent(), onSuccess(), onFailed()) }, "4000");
});
})
And How can I do that with both JQuery and Javascript, maybe there is a pre-defined function to do that easily in JQuery.