Coldfusion jQuery在动态div中查找元素
我有一个动态创建的div,其中包含2个divColdfusion jQuery在动态div中查找元素,jquery,coldfusion,cfml,Jquery,Coldfusion,Cfml,我有一个动态创建的div,其中包含2个div <div style="background-color:##cccccc; font-weight:bold; padding:0px 2px 2px 2px;">Call List Notes</div> <div style="padding:2px 10px 5px 10px; "> <div id="clnoteformdivedit" style="display:none
<div style="background-color:##cccccc; font-weight:bold; padding:0px 2px 2px 2px;">Call List Notes</div>
<div style="padding:2px 10px 5px 10px; ">
<div id="clnoteformdivedit" style="display:none;">
<cfform name="clnotefrm" action="" method="post">
<cfinput type="hidden" name="ClIndNoteIndivnum" value="#val(attributes.UsersID)#">
<cftextarea name="indNote" cols="60" rows="4">#qCallListNotes.notes#</cftextarea>
<br />
<cfinput type="button" name="CallListNotesButton" class="NotesButton" value="Submit Changes" />
</cfform>
</div>
<div id="clnoteformdivdisplay">
#qCallListNotes.notes#<br />
</div>
</div>
这样做的初衷是只显示注释。如果用户单击note/text区域,则div被隐藏,并显示允许输入的div。当他们点击提交按钮时,数据被更新,编辑div被隐藏,显示div
$('##CallListNotesButton').on('click', function() {
var thisuserid = $(this).parent().find('##ClIndNoteIndivnum').val();
var thisindivnote = $(this).parent().find('##indNote').val();
$.ajax({
type: 'POST',
url: "actUpdateClIndivNote.cfm",
data: 'calllistID=' + <cfoutput>#val(attributes.callListId)#</cfoutput> + '&userid=' + thisuserid + '&IndivNote=' + thisindivnote,
error: function(xhr, textStatus, errorThrown) {
// show error
alert(errorThrown);
},
success: function(response1, textStatus, jqXHR) {
//alert('success');
$(this).parent().find('##indNote').val(thisindivnote);
$('##clnoteformdivedit').hide();
$('##clnoteformdivdisplay').show();
}
});
});
$('##clnoteformdivdisplay').on('click', function() {
$('##clnoteformdivdisplay').hide();
$('##clnoteformdivedit').show();
});
问题是在显示分区中显示更新的笔记。我找不到要显示新笔记的正确分区 首先,jquery Selector或ColdFusion中有两个s需要成对使用。只生成一个。不要在$内使用$this。它不是您认为的那样。在$.ajax之前传入变量声明元素,这就是问题所在。我试图找到与我所在的div相关的indNote的更新值。