I actually have a dropdown menu with different actions such as : create task, edit task, delete task.
What I thought about is to manually set the form content by using .html() on the main content div (though I have some difficulties trying to escape the double quotes).
What is the best method in term of performance here ?
- Manually set the html content for each case using html() : eg html("htmlcode:form and input")
- Using load() function to get the content from an external file
- Hide and show different inputs according to the case (a lot to hide and show in my case)
Thanks for your help
Code :
$('#dropdown-choice').click(function()
{
$('#maincontent').html
(
"<form class='form-newproject'>
<fieldset>
<legend>Change email</legend>
<label>New email</label>
<input class=\"form-control\" type=\"email\" name=\"newemail\">
<label>Confirm email</label>
<input class=\"form-control\" type=\"email\" name=\"newemailconfirm\">
<label>Password</label>
<input class=\"form-control\" type=\"password\" name=\"passwordcheck\">
</fieldset>
</form>"
)
});