0

单击控制栏上的按钮时,我需要获取视频标签的 ID。
这在 FF 中有效,但在 IE10 中无效。

<body>
    <div id='video1' class='catPage' data-role='page'>
        <ul id='ul_0' class='catList' data-role='listview' data-filter='true'>";
            <li class='linkCont'>
                <p class='linkpara'>Video1 Title</p>
                <div class='vidCont'>
                    <video id='video1' controls poster='video1_img' preload='metadata' width='224' height='128'>
                        <source src='videos/video1.ogv' type='video/ogg' />
                        <source src='videos/video1.webm' type='video/webm' />
                        <source src='videos/video1.mp4' type='video/mp4' />
                        Your browser does not support the video tag.
                    </video>
                </div>
            </li>
        </ul>
    </div>
</body>

<script>
    (function($){})(window.jQuery);// remap jQuery to $

    $(document).on('pageinit',function () {
        $("video").each(function(){
            $(this).on('click', function(event){
                console.log('vidTagId = ' + $(this).attr('id'));
         });
    });
</script>
4

1 回答 1

0

尝试这个:

$(document).ready(function(){
   $("video").each(function(){
        $(this).on('click', function(event){
            console.log('vidTagId = ' + $(this).attr('id'));
    });
});
于 2013-05-25T16:47:21.377 回答