(function($) { // disable anchors in menu links which are disabled $("li.disabled a").click(function () { return false; }); $("form.confirm").submit(function (event) { event.preventDefault(); var form = this; var text = "Confirm"; var confirmMsg = $(form).attr("confirm-msg"); if (confirmMsg) { text = confirmMsg; } $("
" + text + "
") .dialog({ title: "Confirm", // title buttons: { "Confirm": function () { form.submit(); }, "Cancel": function () { $(this).dialog("close"); } } }); return false; }); $("form:not(.confirm)").submit(function () { if (!$(this).valid()) return; var btn = $(this).find(":submit"); btn.prop("disabled", true); btn.html( 'Loading...' ); }); $(".read-more") .click(function () { var control = $(this).attr('readcontrol'); $("#" + control).toggleClass("read-less"); if ($(this).text() === "Show Less") $(this).text("Show More"); else $(this).text("Show Less"); return false; }); $(".click-submit").on('change', function () { $(this).parents('form:first').submit(); }); })(jQuery);