8
$("#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を設定しようとしていますが、これをどのように行うことができますか?

4

2 に答える 2

19

あなたはこれを試すことができます:デモ

var SplitText = "Title"
var $dialog = $('<div></div>')
    .html(SplitText )
    .dialog({
        height: 500,
        width: 600,
        title: 'Title'});

$dialog.dialog('open');

$dialog.html('Some text');
​

</ p>

</ p>

于 2012-04-28T09:38:47.290 に答える
4

ダイアログ内にコンテンツプレースホルダーが必要です。次に例を示します。

<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を割り当てました。

var note_text = $('#note_content').attr('note_text');

ただし、note_text変数をプレースホルダーに割り当てていません。

于 2012-04-28T09:37:15.213 に答える