我正在运行一个代码,我与你分享,这很简单,在两个不同的console.log()命令的情况下,它返回两个不同的结果.这里的".filter_me"类被分配给一个锚,
$(".filter_me").each(
function(index,value)
{
console.log(index+" is index and "+value+" is value.");
//output of above line is "0 is index and "http://www.ex.com/2
//is value"{for first anchor,http://www.ex.com/ is base url and
//2 is value of href of first anchor}
console.log(value);
//output of above line is <a href="2" class="filter_me">clk</a>
});
Run Code Online (Sandbox Code Playgroud)
那么为什么在第一种情况下
value = http://www.ex.com/2
在第二种情况下
value = <a href="2" class="filter_me">clk</a>
| 归档时间: |
|
| 查看次数: |
160 次 |
| 最近记录: |