• File: ew_contactform_simple.js
  • Full Path: /home/dentaltr/public_html/mullerdenturecentre.com.au/ew_js-20250706124701/ew_contactform_simple.js
  • File size: 1.87 KB
  • MIME-type: text/plain
  • Charset: utf-8
!function(a){a.fn.simpleContactForm=function(b){function c(){function d(a){return"-1"!=a.indexOf("@")&&"-1"!=a.indexOf(".")&&""!=a}var c=a(this);c.submit(function(e){var g,h,i,j,f="",k=!1,l=b.senderEmail,m=b.url;return c.is("[action]")&&(m=c.attr("action")),c.find("input,textarea,select").each(function(){"submit"!=this.type&&(g=a(this),c.find("label").each(function(){a(this).attr("for")==g.attr("id")&&(h=a(this),i=h.html())}),g.removeClass(b.errorClass),null!=h&&h.removeClass(b.errorClass),j=g.is("select")?g.find(":selected").val():"checkbox"==g.attr("type")?g.is(":checked")?"true":"false":"radio"==g.attr("type")?g.is(":checked")?"true":"false":g.val(),g.is(".required")&&0==j.length&&(k=!0,g.addClass(b.errorClass),h.addClass(b.errorClass)),g.is(".required")&&"checkbox"==g.attr("type")&&"false"==j&&(k=!0,h.addClass(b.errorClass)),g.is(".required")&&"radio"==g.attr("type")&&"false"==j&&(k=!0,h.addClass(b.errorClass)),(g.is(".email")||g.is(".senderEmail")||"email"==g.attr("type"))&&(d(j)||(k=!0,g.addClass(b.errorClass),null!=h&&h.addClass(b.errorClass))),g.is(".senderEmail")&&(l=g.val()),g.is(".email")&&""==l.length&&(l=g.val()),"email"==g.attr("type")&&""==l.length&&(l=g.val()),f+="&"+g.attr("id")+"="+i+"||"+j),""==l.length&&(eleEmail=a("input#er"),l=eleEmail.val())}),f=f.substr(1,f.length),k||a.ajax({url:m,type:b.type,data:f+"&emailSubject="+b.subject+"&emailSender="+l,success:function(){b.clearAfterSend&&c.find("input,textarea,select").each(function(){"submit"!=this.type&&"checkbox"!=this.type&&"hidden"!=this.type?a(this).val(""):"checkbox"!=this.type&&a(this).removeAttr("checked")}),b.success()}}),!1})}return b=a.extend({errorClass:"error",senderEmail:"",subject:"New message from your website",url:"php/simpleContactForm.php",type:"POST",clearAfterSend:!0,success:function(){alert('Email sent ! Define this function in "success" parameter')}},b),a(this).each(c),a(this)}}(jQuery);