HTML5’s Data Attributes With jQuery

<html>
    <head>
        <title>Using HTML5's Data Attributes With jQuery</title>
        <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
        <script type="text/javascript">
            $(document).ready(function () {
                var val = $("#custom").data("emailid");
                if (val) {
                    $("#msg").html(val);
                }
            });
        </script>
    </head>
    
    <body>
        <div align="center" style="margin-top:100px;">
            <div>
                <h1>Using HTML5's Data Attributes With jQuery</h1>
            </div>
            <div>
                <input type="text" name="username" data-address="ahmedabad" data-name="Milap"
                data-emailid="cemilap.88@gmail.com" id="custom" />
            </div>
            <div>
                <span id="msg"></span>
            </div>
        </div>
    </body>

</html>
Advertisements

One thought on “HTML5’s Data Attributes With jQuery

I like to hear from you about this !!

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s