如何在Jquery对话框上设置内容 [英] how to set content on Jquery dialog
本文介绍了如何在Jquery对话框上设置内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
$("#note_content").dialog({
title: "Note",
modal: true,
width:'auto',
height:'auto',
resizable:false,
open: function(){
var note_text = $('#note_content').attr('note_text');
}
}
设置note_text作为对话框的内容,任何想法我怎么能做到这一点?
In my code I am trying set note_text as content of dialog, any idea how could I do this?
推荐答案
在对话框中应该有一个内容占位符,例如:
You should have a content place holder inside your dialog, for example:
<div id="noteContent" title="Basic dialog">
<p id="contentholder"> This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>
$("#note_content").dialog({
title: "Note",
modal: true,
width:'auto',
height:'auto',
resizable:false,
open: function(){
var note_text = $('#note_content').attr('note_text');
$("#contentholder").val(note_text)
}
}
您已将您的note_text分配给此行中的变量:
You had your note_text assigned to a variable in this line:
var note_text = $('#note_content').attr('note_text');
但是,您没有将note_text变量分配给占位符。
However, you didn't assign the note_text variable to the placeholder.
这篇关于如何在Jquery对话框上设置内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文