怎么获得当前点击的按钮的id名?

<body>
    

        <input id="t1" type="button" value='fff'>
        <input id="t2" type="button" value='fff'>
        <input id="t3" type="button" value='fff'>
        <input id="t4" type="button" value='fff'>

        <script type="text/javascript">
            $(document).ready(function(){
                $('input').each(function(){
                    alert($(this).attr('id'));
                });
            });
        </script>
  </body>
posted @ 2018-01-25 12:54  yanzi_meng  阅读(776)  评论(0编辑  收藏  举报