jquery默认设置第一个类的css或者属性
var me=$("#cima>input");
me.eq(0).css
var me=$("#cima>input");
me.eq(0).css
jquery写法
$(this).attr("value")
原生写法
全局安装了webpack ,使用webpack的时候,却有如下的提示
One CLI for webpack must be installed. These are recommended choices, delivered as separate packages: - webpack-cli (https://github.com/webpack/webpack-cli) The original webpack full-featured CLI. We will use "npm" to install the CLI via "npm install -D". Do you want to install 'webpack-cli' (yes/no): n You need to install 'webpack-cli' to use webpack via CLI. You can also install the CLI manually.
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>My test</title> </head> <body> <script src="js/jquery.min.js"></script> <div id="txt"></div> <a href="https://www.163.com"><span>ppp</span></a> <div id="xs_my"> <div id="fb-root"></div> <div class="fb-share-button" data-href="https://www.eobdmall.com/product_content.php?product_id=1015" data-layout="button_count" data-size="large"><a target="_blank" href="https://www.facebook.com/sharer/sharer.php?u=https://www.eobdmall.com/product_content.php?product_id=1015;src=sdkpreparse" class="fb-xfbml-parse-ignore">分享</a></div> </div> <script type="text/javascript"> $(".fb-share-button").click(function(event) { setTimeout(function() { $("#xs_my").html('<button type="button" onclick="timedText()">see my </button>') }, 5000); }); function timedText(){ var x=document.getElementById('txt'); var t1=setTimeout(function(){$("#txt").html("2 秒")},2000); var t2=setTimeout(function(){$("#txt").html("4 秒")},4000); var t3=setTimeout(function(){$("span").click()},6000); } </script> </body> </html> <a href="https://www.facebook.com/sharer/sharer.php?u=example.org" target="_blank"> Share on Facebook </a> <script type="text/javascript"> // $(document).ready(function() { // setTimeout(function() { // $("span").click(); // }, 1000); // }); </script>
自动触发a链接的方法如下:
1.
<body > <a href="http://www.shengmake.net" ><span>Affiliate</span></a> </body> <script src="jquery-3.6.0.min.js"></script> <script type="text/javascript"> $(document).ready(function() { setTimeout(function() { $("span").click(); }, 1000); }); </script>
刚创建的元素,使用jQuery的each方法来遍历,有时候会不起作用。
原因不用多说,经常使用javascript的人应该都会知道,解决方案大致有2种:
//获取cookie function getcooki(name) { var name=name+"="; var mine=document.cookie.split(';'); var c=mine[0].trim(); var last=c.substring(name.length,c.length); return last }