0
不知道什么是解决这个如何让每一个下拉菜单和文本区域排
我想基于什么在下拉列表中选择来控制TE textarea的原因正确的方法的ID。正如你可以看到下面我已经到了我可以得到DropDown列表的每一行的属性ID的阶段状态但我无法得到每个textarea的attr id原因
我的最终结果应该是如果一个用户选择拒绝,然后用户输入一个原因,如果停用必须输入日期。在此先感谢
<tr>
<td class="ms-vb"><span dir="none">
<select class="ms-RadioText" title="Status" id="WebPartManager_g_31f0d9e1_72a0_4ef2_b286_7c30cd0fda1f_ff5_3_ctl00_DropDownChoice" name="WebPartManager$g_31f0d9e1_72a0_4ef2_b286_7c30cd0fda1f$ff5_3$ctl00$DropDownChoice">
<option value="Provisionally Approved" selected="selected">Provisionally Approved
</option>
<option value="Approved">Approved</option>
<option value="Declined">Declined</option>
<option value="Deactivated">Deactivated</option>
</select><br>
</span></td>
<td class="ms-vb">
<span dir="none">
<textarea dir="none" class="ms-long" title="Reason" id="WebPartManager_g_31f0d9e1_72a0_4ef2_b286_7c30cd0fda1f_ff11_3_ctl00_ctl00_TextField" cols="20" rows="6" name="WebPartManager$g_31f0d9e1_72a0_4ef2_b286_7c30cd0fda1f$ff11_3$ctl00$ctl00$TextField" style="display: none;">Test3</textarea><br>
</span></td>
</tr>
$(document).ready(function(){
$("textarea").hide();
$("input[title$='DeActivatedDate']").hide();
$("tr select[title='Status']").change(function() {
var selectedValue = $(this).find("option:selected").text();
if (selectedValue == 'Declined')
{
alert('You need to type in a Reason if STATUS is DECLINED!');
//i'm getting the id of each dropdown row here
var select_id = $(this).attr('id');
var b = $("#" + select_id).text();
alert(select_id);
//i can get the id of each Dropdown of each row
//i'm getting the id of each textarea row here
var textarea_id = $("tr td textarea").attr('id');
var c = $("#" + textarea_id).text();
alert(textarea_id);
//i'm only getting the attr id of the first textarea but not the other
}
if (selectedValue == 'Deactivated')
{
alert('You need to select a De-Activated Date if STATUS IS DEACTIVATED!');
}
});
});
感谢。但我不想要所有textarea的id。我非常希望与dropdownlist相同的那一行。我需要将所选项目与textarea框中的值进行比较。如果选择的值被拒绝,则用户必须在textarea的相应行中添加一些文本。 – naijacoder
@naijacoder:看我的更新。 –
谢谢亩太短会给那个尝试让你知道 – naijacoder