JavaScript - Eliminar boton en javascript

 
Vista:
sin imagen de perfil

Eliminar boton en javascript

Publicado por Aproximo (4 intervenciones) el 11/09/2014 19:42:55
Hola chicos.

Una duda... Tengo un formulario en php y un javascript que hace que se pueda ir rellenando paso a paso. Pues bien, para que aparezca el formulario hay que clickear antes en un botón. Eso es justo lo que no quiero que ocurra, es decir, quiero que simplemente aparezca el formulario cuando se cargue la página. Llevo ya unos cuantos días y no soy capaz de desvincularlo, porque cuando elimino el button en php me desaparece el formulario, aunque también elimine el "display:none". Aquí os dejo los códigos.

Muchas gracias!!!


----------------------------PHP ----------------------------

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<button id="init-advanced-form" type="button" class="btn btn-large btn-primary">Start Example</button></p>
                <form id="example-advanced-form" action="#" style="display: none;">
                    <h3>Account</h3>
                    <fieldset>
                        <legend>Account Information</legend>
 
                        <label for="userName-2">User name *</label>
                        <input id="userName-2" name="userName" type="text" class="required">
                        <label for="password-2">Password *</label>
                        <input id="password-2" name="password" type="text" class="required">
                        <label for="confirm-2">Confirm Password *</label>
                        <input id="confirm-2" name="confirm" type="text" class="required">
                        <p>(*) Mandatory</p>
                    </fieldset>
 
                    <h3>Profile</h3>
                    <fieldset>
                        <legend>Profile Information</legend>
 
                        <label for="name-2">First name *</label>
                        <input id="name-2" name="name" type="text" class="required">
                        <label for="surname-2">Last name *</label>
                        <input id="surname-2" name="surname" type="text" class="required">
                        <label for="email-2">Email *</label>
                        <input id="email-2" name="email" type="text" class="required email">
                        <label for="address-2">Address</label>
                        <input id="address-2" name="address" type="text">
                        <label for="age-2">Age (The warning step will show up if age is less than 18) *</label>
                        <input id="age-2" name="age" type="text" class="required number">
                        <p>(*) Mandatory</p>
                    </fieldset>
 
                    <h3>Warning</h3>
                    <fieldset>
                        <legend>You are to young</legend>
 
                        <p>Please go away ;-)</p>
                    </fieldset>
 
                    <h3>Finish</h3>
                    <fieldset>
                        <legend>Terms and Conditions</legend>
 
                        <input id="acceptTerms-2" name="acceptTerms" type="checkbox" class="required"> <label for="acceptTerms-2">I agree with the Terms and Conditions.</label>
                    </fieldset>
                </form>

-------------------------------JAVASCRIPT---------------------------------------------------


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
$(function ()
        {
 
 
            $("#init-advanced-form").one("click", function(e)
            {
                e.stopPropagation();
                $(this).remove();
 
                var form = $("#example-advanced-form").show();
 
                form.steps({
                    headerTag: "h3",
                    bodyTag: "fieldset",
                    transitionEffect: "slideLeft",
                    onStepChanging: function (event, currentIndex, newIndex)
                    {
                        // Allways allow previous action even if the current form is not valid!
                        if (currentIndex > newIndex)
                        {
                            return true;
                        }
 
                        // Needed in some cases if the user went back (clean up)
                        if (currentIndex < newIndex)
                        {
                            // To remove error styles
                            form.find(".body:eq(" + newIndex + ") label.error").remove();
                            form.find(".body:eq(" + newIndex + ") .error").removeClass("error");
                        }
 
                        form.validate().settings.ignore = ":disabled,:hidden";
                        return form.valid();
                    },
 
 
                });
            });
 
 
        });
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder