dimanche 11 août 2019

append with if statement

I need use if (else if, else) statement with many .append() functions. Just like you can see in my example... Is it possible ? Thank you.

 $('body')
      .append($('<div>', {class: 'wrapper'})

           // if statement comes here
           .append($('<div>')
                .append($('<form>')
                     .append($('<input>'))
                 )
            )

           // else if statement comes here
           .append($('<div>')
                .append($('<form>')
                     .append($('<input>'))
                 )
            )

           // else statement comes here
           .append($('<div>')
                .append($('<form>')
                     .append($('<input>'))
                 )
            )

            // end if

       );

Aucun commentaire:

Enregistrer un commentaire