To validate a phone number with a regular expression (regex), we will use type and pattern attribute in HTML input field. Adding a class gives us a hook, if needed, to add CSS: A Stackoverflow question: conditionally hiding zero values in a table Today I stumbled upon this question on stackoverflow: Is there a way to hide a data cell based on a specific value using just HTML/CSS? CSS provides several properties that allows you to define various text styles such as color, alignment, spacing, decoration, transformation, etc. How to convert JSON string to array of JSON objects using JavaScript ? When do you use . If the phone number, or the way it’s entered on the site, doesn’t match a pattern it could be missed. I would like to be able to have my employees enter in a phone number but always format it once they click off on the field to (xxx)xxx-xxxx. Let's see how to set these text properties for an element in more detail. Example Input: 9809142333 Output: (980) 914-2333 Format phone number without country code. Entering it correctly on authors’ websites is vital if you need support! North American phone numbers. Experience. Recommended: (415) 555-0132. International phone numbers Browsers respond differently to these protocols. Applying this property to an HTML element will turn all text within that element to the specified color.