touch support check

by Omar X

HTML

<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.0/jquery.mobile-1.4.0.min.css" />
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script>
    var custom_event = '';
    $(document).on("mobileinit", function() {
        custom_event = $.support.touch ? "vclick" : "click";
    });
</script>
<script src="http://code.jquery.com/mobile/1.4.0/jquery.mobile-1.4.0.min.js"></script>
<script>
    $(document).on("pagecreate", function() {
        $("[data-role=content]").prepend("<p>Browser supports: " + custom_event + "</p>");
        $(document).on(custom_event, "a.ui-btn", function(e) {
            $("[data-role=content]").append("<p>Event: " + e.type + "</p>");
        });
    });
</script>
<body>
    <div data-role="page" id="p1">
        <div data-role="header" data-theme='b'>
             <h1>Header</h1>

        </div>
        <div data-role="content" data-theme='a'><a href="#" class="ui-btn">Test event</a>

        </div>
        <div data-role="footer" data-position='fixed'>
             <h4>Footer</h4>

        </div>
    </div>
</body>