I have a button called "new" ...
<input type="submit" style="width:200px; height:28px;" name="nueva" id="nueva" value="Añadir">
I want to select or click, open a form / div to fill in some data.
<form action="<?php echo $_SERVER['PHP_SELF'];?>" name="anadir" id="anadir" method="POST">
<label for="nombre">Nombre: </label><input type="text" id="nombre" name="nombre"/></label><br/><br/>
<label for="capacidad">Capacidad: </label>
<?php
echo "<select name='capacidad'>";
for($i=1; $i<11; $i++){
if($i==1){
echo "<option value='$i' selected='selected'>$i</option>";
}else{
echo "<option value='$i'>$i</option>";
}
}
echo "</select>";
?><br/><br/>
<label for="descripcion">Descripción: </label><input type="text" id="descripcion" name="descripcion"/></label><br/><br/>
<label for="precio">Precio: </label><input type="text" id="precio" name="precio"/></label><br/><br/>
<input type="submit" value="Guardar" id="guardar" name="guardar"/>
<input type="reset" value="Resetear" id="resetear" name="resetear"/>
</form>
Doubts:
1) Why does it open but close to the second one? Without giving option to fill in data.
2) How would you rate if all the fields are filled out, and click "Save", close the form?
JQuery code:
$(document).ready(function(){
$('#anadir').hide();
$("#nueva_cabana").on("click", function() {
$('#anadir').show();
});
});