appending a value from dialog box to body

appending a value from dialog box to body

I am having a problem of appending a value from the textbox in the dialog box to my html body.

<div id="dialog-form"> <form> <label for="name">Name</label> <input type="text" name="name" id="txt2 codein" class="text ui-widget-content ui-corner-all" /> </form> </div> <p>Please are you <span id="addname"></span> setTimeout( function() { $( "#dialog-form" ).dialog({ modal: true, draggable: false, height: 300, width: 500, open: function () { $('body').addClass('stop-scrolling'); }, }); },4000); var keeptrying = function(e) { var addmust = $('#dialog-form #codein').val(); $("#addname").append("#dialog-form #codein"); }

Any help and answer is appreciated thanks