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 8936097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T10:08:27+00:00 2026-06-15T10:08:27+00:00

Im using jquery Masked input plugin. I have the following mask on a field:

  • 0

Im using jquery Masked input plugin.

I have the following mask on a field:

 "?999-999-9999 x9999"

Why ? in begining? because if user entered incomplete number, i dont want the field to clear out so i made the whole thing optional. now when user is entering the numbers is able to see x always whether or not a phone has extension. How do i get rid of that x if no extension was given?

Again i do not want to clear out the field, if i use

  "999-999-9999? x9999" 

yes it works it adds x only when it has extension but if incomplete phone entered it empties the field which is not the goal.

Any help is appreciated thanks alot.

  • 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-15T10:08:28+00:00Added an answer on June 15, 2026 at 10:08 am

    after trying alot i fixed it myself to accomplish the goal.

    Goal was to keep text not disappearing if incomplete input was given and to get rid of x if no extension was given.

    I added this test at the end of code:

    var splitString = $("[name=myinput]").val().split("x");
    //if splitString array length is more than 1 means splitString[1] is set
    //if splitString[1].length is 0 means its only x by itself so get rid of it
    if (splitString.length > 1 && splitString[1].length == 0) {
        $("[name=myinput]").val($("[name=myinput]").val().replace("x", ""));
    }
    

    examples:

     entered text: 718-111-123 x -> turns into -> 718-111-123
     entered text: 718-111     x -> turns into -> 718-111
     entered text: 718-111-123 x555 -> turns into -> 718-111-123 x555
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the jquery mask from Digital Bush: http://digitalbush.com/projects/masked-input-plugin/ I have a customer signup
I'm using JQuery Masked input plugin. $(#percent).mask(99.99?9); This allows numbers like 10.999, 10.99, 01.999,
I am using the jQuery mask plugin from http://digitalbush.com/projects/masked-input-plugin/ I want to customize my
i'm using successfully a jquery datepicker with masked input plugin too in a aspx
I'm using the jQuery Masked Input Plugin from here: Digital Bush I'm also using
I'm using http://digitalbush.com/projects/masked-input-plugin/ plugin. There is an input text with defined mask: <input type="text"
I am using Masked Input Plugin from digitalBush for jQuery, which is very simple
I am using jquery date input plugin from here I call the function inside
I am using the jquery validation plugin to validate a form. I have the
I have problem while using jquery maskedinput with asp.net textbox. I have a check

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.