如何通过jQuery中的类为特定的html元素获取innerHTML? [英] How to get innerHTML for a particular html element through its class in jQuery?
本文介绍了如何通过jQuery中的类为特定的html元素获取innerHTML?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这样的HTML代码:
I have HTML code like this:
<div class="a">html value 1</div>
<div class="a">html value 2</div>
如何访问 html值1
和 html值2
使用jquery?
How can I access html value 1
and html value 2
using jquery?
推荐答案
$('.a')[0].innerHTML;
$('.a')[1].innerHTML;
这篇关于如何通过jQuery中的类为特定的html元素获取innerHTML?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文