How to extend jQuery to make it easier to retrieve the tagName

前端 未结 4 514
不思量自难忘°
不思量自难忘° 2020-12-06 09:32

I am looking to extend jQuery so I can easily retrieve the tagName of the first element in a jQuery object. This is what I have come up with, but it doesn\'t seem to work:

4条回答
  •  旧时难觅i
    2020-12-06 10:20

    Why create a plugin at all? Seems a bit unnecessary...

    alert( $('div')[0].tagName );
    

提交回复
热议问题