Tag: html5

  • Use HTML5 Pattern to Input Specific URL using Regular Expression

    HTML5 Pattern works on the principle of regular expression, set of code defining a pattern.This htm5 pattern attribute helps in form validation and 99% accurate data input from user. In this tutorial, we will create a regular expression to validate URL field.

    learn-html5-to-create-websi.jpg
    Html5 Pattern Attribute

    What is Regular Expression?

    Regular expression is a set of characters which defines pattern to validates an expression. It helps in searching a word/character/letter in a given expression and returns true or false. For instance, a regular expression can extract “feel” word or “very lucky” words from “I am feeling very lucky today”.

    In this tutorial, we will validate various input fields to accept Youtube, Facebook, Twitter urls.

    Validate Input Field with Regex

    Here is a syntax for regular expression:

    Validating Youtube URL

    [code]
    <input type="url" pattern="http://www\.youtube\.com\/(.+)|https://www\.youtube\.com\/(.+)" />[/code]

    Validating Facebook URL

    [code]
    <input type="url" pattern="http://www\.facebook\.com\/(.+)|https://www\.facebook\.com\/(.+)" />
    [/code]

    Validating Twitter URL

    [code]
    <input type="url" pattern="http://\.twitter\.com\/(.+)|https://\.twitter\.com\/(.+)" />
    [/code]

    Above expression checks for a valid Youtube, Facebook & Twitter URL with protocols, either http or https.

    Demo

    Valid:

    Invalid:

    What’s Next?

    If you are looking to validate a custom name, then simply replace the words Youtube with your custom name. Such kinda validations are helpful for precise data input such as registration forms or contact forms.

    If you have any queries or need any assistance, then post them using the comment form below.

  • Learn HTML5 to Create Interactive Website on Web – [Introduction]

    You must be looking for some latest Twitter , Facebook or WordPress updates, guess what ? Its time for the Web HTML updates now. Yes, HTML5 is the next generation of HTML. If you haven’t heard about HTML5 at all or if you are curious to know about it, then this post is for you.

    learn-html5-to-create-website
    Create New Web using HTML5

    This article, Learn HTML5 to Create Interactive Website on Web – [Introduction] covers the basic elements of HTML5 and new features added in HTML5. I have divided this post into three parts – What is HTML5?, Reason behind HTML5 Concept and What’s New about HTML5?

    What is HTML5?

    A new version of HTML which is still a work-in-progress, is supported by a lot of modern browsers like Mozilla 4+, Google Chrome & Opera. Previous version of HTML was launched in year 1999 and since then a lot of refinements were made in terms of HTML, XHTML and HTML DOM.

    Well, HTML5 will be the mixture all these three versions of HTML which were launched over the time and it will be an awesome improvement for page speed, browser compatibility and error handling. I am anxious to see this new web version, are you not ? Read below why we need HTML5 ?

    Reason behind HTML5 Concept

    A collaboration of different minds, W3C and WHATWG, decided to create new and a better version of HTML. And the major factors considered for this revised version of HTML are as under:

    • New Features based (mostly on HTML, CSS 3.0 and JavaScript/jQuery)
    • Open Source Code (Development will be visible to everyone)
    • Robust Error handling (For Quick bug fix and resolution)
    • Device Independent (Doesn’t matter if its iMac, Windows, Android or iPhone)
    • No third party plugins like Flash or Quick Time Players (Thats understood, isn’t it ?)

    What’s New about HTML5?

    Already excited to create with HTML5, check out some new features of HTML5 below:

    • Canvas Element for Drag Drop, Wrap Text, Drawing
    • Form Controls for calendar, date/time, email, search
    • Audio and Video Elements for playback
    • Content Elements like article header/footer, nav, section

    Is that all ?

    Neah, its just that I am so lazy to type that long list of new features in HTML5 for you. 😛 Perhaps, the above mentioned features are the vital ones, while I will elaborate these features in detail with my future posts. So keep in touch with us to learn HTML5 to Create Interactive Website on Web. 😉