So I am trying to make a custom in place editor in mootools and I want to use a form. Whenever I do try to create a form it just creates <form class="inplaceeditor-form" method="post" action="#"/>
How can I make it a form where I can inject other elements?
From stackoverflow
-
You have to create the other input elements to go inside the form. Something like this:
// create the form element var form = new Element('form', {'action' : 'your/action', 'class' : 'inplaceeditor-form'}); //create the textbox var textarea = new Element('textarea', {'name' : 'myTextarea'}); //create the submit button var button = new Element('input', {'type' : 'submit', 'value' : 'Submit Me!'}); // this puts the textarea and the button into the form form.adopt(textarea,button); // put the form inside what ever container you user $('myContainer').adopt(form); // the code above should give you this <div id="myContainer"> <form action="your/action" method="post" class="inplaceeditor-form"> <textarea name="myTextarea"></textarea> <input type="submit" value="Submit Me!" /> </form>
0 comments:
Post a Comment