0

I have this div, where divBrdr should contain a form summaryConfig

 <div id="popup">
<div id="popupClose">
    <input type="image" alt="close window" src="images/close_btn.gif" width="20" height="20" onclick="" align="right">
</div>
<div id="divBrdr" >

</div>
</div>
<div id="backgroundPopup">
</div>

Right now i have this form inside divBrdr but then this popup appears differently for create and update so I wanted to make this form made dynamically. Can somebody help me do that?

<form style="padding-bottom:11px;" name="summaryConfig" method="post" action="">
<img alt="title" src="images/update_conform_title.gif" width="189" hspace="4" height="17" vspace="4"><br>
&nbsp;<br>

<table align="center" width="90%" border="0" cellspacing="0" cellpadding="0">
    <tr>    <td width="800"></td>  </tr>
</table>

<div id="postUploadInfo">
</div>

<table align="center" border="0" cellpadding="10" cellspacing="0" width="84%">
    <tr>
        <td colspan="3" align="center">
            <label>
                <input  type="button"  tabindex="4" id="btnOk" value="Done" class="btn" onClick="">
            </label>
        </td>
    </tr>
</table>
</form>
2
  • you want to add this form on body load or on some event handler? Commented Jun 10, 2011 at 8:17
  • @Vivek: on any event handler, say i have a button after popup div Commented Jun 10, 2011 at 8:19

1 Answer 1

1

if you want to add this form dynamically then you can hold your form in a variable and append that variable to divBrdr div on button click.

 VariableHoldingForm = "<form style='padding-bottom:11px;' name='summaryConfig' method='post' action=''> ";
   VariableHoldingForm +="<img alt='title' src='images/update_conform_title.gif' width='189' hspace='4' height='17' vspace='4'><br> &nbsp;<br> ... and till...</form>'
    $('#buttonId').click(function(){
        $('#divBrdr').append(VariableHoldingForm);
    });

even you can use document.createElement() to create any html tag

 **EDIT**

to unAppend remove html of your div like this..

$('#divBrdr').html('');

and then again add new form element variable on update button

$('#updateButton).click(function(){
            $('#divBrdr').append(newForm);
        });
Sign up to request clarification or add additional context in comments.

5 Comments

how can i hold that from in some variable? Also how will i add styling to the form this way
you need to escape double quotes:)
@Vivek: Assuming this appending happens on create button click, what if i want to append some other form contents on update button click, then how to unappend and re append another variable containing form?
to unappend you can simply remove html of your div like this.. $('#divBrdr').html('');
and click right click beside my answer if i answered your question

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.