Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8387811
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:18:59+00:00 2026-06-09T18:18:59+00:00

I have a form so when user click on edit button then the text

  • 0

I have a form so when user click on edit button then the text replace with input type=”email” and also matches the given patterns of email

               <label for="name-c">Email-Id:</label>
             <label class="email">abc@xyz.com</label>
                 <button class="edit">edit</button>

Jquery code:

$('.edit').click(function () {
  var email=$('.email').text();
   $('.email').replaceWith(function () {
     var pattern = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,6}$/;
     return '<input type="email" id="email" name="email" title="Enter email like abc@xyz.com" required placeholder="abc@xyz.com"   pattern="' + pattern + '"'+'class="ui-input-text ui-body-c ui-corner-all ui-shadow-inset"/>'});
     $('#email').val(email);});

I am getting error message please type the given pattern though it is right.
But when I matching by simple placing by input type="email" followed by pattern then its matching.I totally confused where my code is incorrect.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T18:19:01+00:00Added an answer on June 9, 2026 at 6:19 pm

    I think you don’t need a pattern. When you specified the type="email" it is the navigator which control the value. I test [here][1] with the default param and it works for me with chrome and firefox. But when I add a pattern like “.*” the check fails it is curious.

    Int the specification given by W3C they allow the attribute pattern but when you scroll down to value they the value is check with a specified value.

    So you don’t need to add the pattern the check is implicit.

    EDIT :

    Try with this regexp ^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:.[a-zA-Z0-9-]+)+$ I take the regexp defined in w3c specifcation and I change the final * by a +.

    EDIT :

    Finally I found the mistake in fact it misses a backslashes when you add the input with jquery here the solution http://jsfiddle.net/KaBut/6/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form with a few input fields. When a user clicks on
i have form with user data to input and javascript ajax to send information
I have a form to edit employee information. If the user wishes to enter
I am using jquery to clone a form input field when user click on
I have a form with a Clear button. When the user clicks Clear, I
I have a form. When the user clicks disable I want to disable all
I have a form whereby a user fills it in and clicks submit. This
I have an HTML page with a simple form. When the user clicks submit,
I have form where user submits field. Field can have letters, numbers, and punctuation.
If I have form where user can upload files via Ajax (and upload is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.