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

Posted by Salsa on Stack Overflow See other posts from Stack Overflow or by Salsa
Published on 2013-10-29T03:45:55Z Indexed on 2013/10/29 3:53 UTC
Read the original article Hit count: 114

Filed under:
|

I am opening a modal dialog by loading a form into it. After loading the form, I want to change it's title and one of it's fields' label. I can change the label's text, but after the function returns, the label's text turns back to it's original one. Is it possible to make this kind of change and if so, how?

The HTML:

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

The 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');
});

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery