我想访问特定div
内的input
。我有这样的HTML:获取其他元素内的元素
<div id="'.str_replace(' ','',$systeme_culture['nom_plante']).'">
<table class="table">
<th>
<tr colspan="2">
<label>Nom : </label>
<input id="nom_itk" value="test">
</tr>
</th>
</table>
</div>'
我要访问的全球DIV中的ID nom_itk
,但我不知道该怎么办。我尝试了.find()
,但它不起作用。
我的JS是:
$('#'+nom_culture).find('#nom_itk').html("test");
全球DIV被称为与JS变量nom_culture
。
在此先感谢!
为什么不只是'$('#nom_itk')。html(“测试“);'??? –
'nom_culture'变量的值是多少?是否与'str_replace('','',$ systeme_culture ['nom_plante'])''相同? – Rayon
您的HTML无效。标签和输入移动到桌子外面。 – Oriol