function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rohit AlladiRohit Alladi 

re: how to create fields on press of an add button

Hi ,

How to create fields or show fields on pressing of an add button using java/html/apex. i want  new fields to be created when i press add button.

Sri549Sri549

Hi,

 

    This is the code for creating sample text field when we click on button called new button

based on this code shown you can chahgeaccording to your requirement

 

 

<apex:page>

<div id="div2"></div>
 
<input type="button" id="btnok" onclick="addText();" value="New Button" />
        <br />



  <script type="text/javascript">
function addText()
        {
        var div1=document.getElementById("div2");
        div1.innerHTML="<input type='text'/>";
        }
 </script>
</apex:page>

 

 

Thanks

Srinivas