Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script>
- function validateform() {
- var email = $('#txt_emailID').val();
- if (email == null || email == "") {
- alert("Email Should Be Complusory");
- return false;
- }
- var atposition = email.indexOf("@");
- var dotposition = email.lastIndexOf(".");
- if (atposition < 1 || dotposition < atposition + 2 || dotposition + 2 >= email.length) {
- alert("Please enter a valid e-mail address...!!!");
- return false;
- }
- }
- </script>
- <label for="fname">Name</label>
- <input type="text" id="txt_name" name="txt_name" placeholder="Your Name.." />
- <label for="lname">EmailID</label>
- <input type="text" id="txt_emailID" name="email" placeholder="Your EmailID.." />
- <label for="lname">Subject</label>
- <input type="text" id="txt_subject" name="txt_subject" placeholder="Your Subject.." />
- <input type="submit" id="submit_mail" value="Send" />
- <script>
- $(function () {
- $(document).on("click", "#submit_mail", function () {
- if (validateform() == false) {
- document.getElementById("txt_name").value = $('#txt_name').val();
- document.getElementById("txt_subject").value = $('#txt_subject').val();
- }
- else {
- }
- });
- });
Add Comment
Please, Sign In to add comment