【发布时间】:2015-09-22 17:12:46
【问题描述】:
我确实有可以工作的代码,但我需要修改它
http://jsfiddle.net/bthorn/xbs5c41b
然后我被告知我需要从输入更改为标签(跨度)
现在即使我从
更改,此代码也不起作用http://jsfiddle.net/bthorn/xbs5c41b/1/
.find("input")
到
.find("span")
注意我注释掉的代码行
function setDateTimeOn(elm) {
var formattedDate = GetCurrentDateTime(); //get formatted date
$(elm) //clicked button
.parent("td") // container td
.next() // next td
//.find("input") // find child input
.find("span")
.val(formattedDate); //set date
}
HTML
<table>
<tr>
<td style="width:5px;">
<input type="button" id="GridView1__ctl2_AddButton0" name="GridView1:_ctl2:AddButton0" value="On" class="btn-blue" onclick="setDateTimeOn(this)">
</td>
<td style="width:150px;">
<!-- <input id="GridView1__ctl2_txtStormTimeOn" type="text" name="GridView1:_ctl2:txtStormTimeOn" value="">-->
<span id="GridView1__ctl2_lblStormTimeOn"></span>
</td>
</tr>
“.find() 不能在 span 上工作吗?
【问题讨论】:
标签: jquery