用 jquery 实现在html中,点一下即获取当前单词

来源:互联网 发布:淘宝限时打折怎么取消 编辑:程序博客网 时间:2024/06/13 11:23
<!DOCTYPE html><html>    <head>        <script type="text/javascript" src="jquery-3.2.1.min.js"></script>        <script type="text/javascript">        $(document).ready(function(){          $("span").click(function(){            alert($(this).text());          });        });        </script>    </head><body><h1>My Web Page</h1><p id="demo"><span id="ka">A</span> <span id="ke">Paragraph</span></p></body></html>
阅读全文
0 0
原创粉丝点击