更改具有相同标签ID的标签的值 [英] change the value of a label with same tag id

查看:53
本文介绍了更改具有相同标签ID的标签的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过按钮单击事件通过具有相同标签id的标签的id获取元素.但是它只读取第一个元素的值.如果可以的话,请给我一种方法,让我可以读取标签的所有值.如果可以的话请帮助我.谢谢.

I want to get element by its id of a label with same tag id by a button click event. But it only read the first elements value. If you can please give me a method how I can read all the values of labels. If you can please help me. Thank You.

推荐答案

假设您的标签ID为="label1"

因此要在onclick上获得其价值,只需将代码放入onclick函数中,例如

suppose u have label with id ="label1"

so to get its value on onclick just put that code into onclick function like

function getvalue()
{
var value=


(" ).text(); }
("#label1").text(); }


Jeremy Shin Woo-13 Jun''12
有两个具有相同详细信息的表.我想通过一个表中的按钮单击事件来更新两个标签的值.

Elsalmo 3likom,
亲爱的,
如果要更新两个表中的两个标签,请给它们相同的类
Jeremy Shin Woo - 13 Jun ''12
There are two table with same details. I want to update both label''s value by a button click event in one table.

Elsalmo 3likom,
Dear,
if you want to update both labels in two table give them same class
<label class="asd">fff</label>
<label class="asd">llll</label>


然后在click事件中编写此代码


and in the click event write this code

//this line to set the two lable


这篇关于更改具有相同标签ID的标签的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆