Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>Hello Jacob,</strong> it seems that you need to know some basics for creating a well based and tidy java script codes. I think the problem with your code is that you are making some small problems which are sometimes unable to be seen. Here is a updated code, tell me if this works or not.</p> <pre><code>var validator = $("#newClient"); function radioChange() { if (document.getElementById("yesbutton").checked === true) { document.getElementById("emailSpan").style.display = "none"; document.getElementById("cemailSpan").style.display = "none"; document.getElementById("emailError").style.display = "none"; document.getElementById("cemailError").style.display = "none"; validator.resetForm(); } else if (document.getElementById("nobutton").checked === true) { document.getElementById("emailSpan").style.display = 'block'; document.getElementById("cemailSpan").style.display = 'block'; document.getElementById("emailError").style.display = "block"; document.getElementById("cemailError").style.display = "block"; validator.validate({ rules: { Email: { required: true, minlength: 4, maxlength: 48, email: true }, ConfirmEmail: { required: true, minlength: 4, maxlength: 48, email: true, equalTo: "#Email" } }, messages: { Email: { required: "Please enter a valid email address", email: "Please enter a valid email address", maxlength: "Max length is 48" }, ConfirmEmail: { required: "Please enter a valid email address", email: "Please enter a valid email address", maxlength: "Max length is 48", equalTo: "Emails do not match" } }, errorPlacement: function(error, element) { if (element.attr("name") === "ConfirmEmail") { error.appendTo("#cemailError"); } else if (element.attr("name") === "Email") { error.appendTo("#emailError"); } } }); } } </code></pre> <p><strong>Hope This Helps!</strong></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload