显示自动完成响应多个值

时间:2016-12-30 12:41:59

标签: javascript jquery jquery-ui jquery-ui-autocomplete

enter image description here

我能够附加图像,我想在hallticket号码中附加学生ID,我该怎么做。 这是我的HTML:

<td><b>Hallticket:</b>S<div><p class="hallticketNumber">***studentid has to come here***</p>J'+jobID+'</div></td>
<td><div><img class="participantphoto" src=""/><input class="searchStudent" type="text" autocomplete="off"><input class="studentId" type="hidden" name="gdtest['+studentCount+'][studentId]"></div></td>

这是我尝试过的:

$(this).closest('div').find(".studentId").attr("value",ui.item.student_pid);//working
$(this).closest('div').find(".participantphoto").attr("src",ui.item.profile_pic);//working
$(this).closest('div').find(".hallticketNumber").attr("label",ui.item.student_pid); //Notworking
  

错误位于.attr("label",ui.item.student_pid);附近的最后一行

1 个答案:

答案 0 :(得分:2)

使用text()动态更改段落的内容。

$(".hallticketNumber").text(ui.item.student_pid);
相关问题