簡體   English   中英

將html加載到對話框后如何更改標簽的文本

[英]How to change a label's text after loading a html into a dialog

我正在通過將表單加載到其中來打開模式對話框。 加載表單后,我想更改它的標題和其中一個字段的標簽。 我可以更改標簽的文本,但是在函數返回后,標簽的文本將恢復為原始文本。 是否可以進行這種更改,如果可以,如何進行?

HTML:

<form action="testing.php" method="POST" id="example-form">
    <fieldset>
        <label for="link" id="link-label"></label>
    </fieldset>
</form>

JavaScript:

$(".bt-example").button().click(function() {
$('#example-dialog').load('form.html').dialog('open');
$('.ui-dialog-titlebar').text("THIS WORKS!");
$('#example-form #link-label').text("CHANGES AT FIRST, BUT GOES BLANK LATER");
$('#example-dialog').removeClass('invisible');
});

我想知道您是否需要更具體地定位目標...例如,在更改#link-label

$('#example-dialog').find('#link-label').text('Changes at first, and should stay...');

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM