首页 > 语言 > JavaScript > 正文

get(0).tagName获得作用标签示例代码

2024-05-06 16:09:27
字体:
来源:转载
供稿:网友
get(0).tagName可获得作用标签,下面是它的一个小应用,在学习js的朋友可以参考下
 
 

 

复制代码代码如下:

<script type="text/javascript" src="jquery1.4.js"></script>
<script type="text/javascript">
$(function(){
$(".test li,.test dd").click(function(){
alert('本身为大写:' + $(this).get(0).tagName + '/n利用toLowerCase()转换为小写:' + $(this).get(0).tagName.toLowerCase() + '/n利用toUpperCase()转换为大写:' + $(this).get(0).tagName.toUpperCase());
})
});
</script>

 

<div class="test">
<ul>
<li>lili</li>
<li>lili</li>
</ul>

<dl>
<dd>dddd</dd>
<dd>dddd</dd>
</dl>
</div>

 

 

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表

图片精选