我想在点击标签后获取标签的值。我只使用JavaScript和没有jQuery。 这里是我的html:使用javascript获取标签的值
<div class="touche 1">
<h1>1</h1>
</div>
<div class="touche 2">
<h1>2</h1>
</div>
<div class="touche 3">
<h1>3</h1>
</div>
我所需要的值1,2,3,等...到一个变量。 div的工作就像一个计算器按钮!
谢谢!
而你究竟在何处遇到问题,当你试图解决这个自己? – 2014-10-10 18:18:20
http://stackoverflow.com/questions/19451144/how-do-i-get-html-tag-value-div-in-javascript – 2014-10-10 18:18:32
我只是试过函数$ id(id){return document.getElementById(id) ;} – ahbon 2014-10-10 18:22:52