lundi 26 septembre 2016

ajax append something if condition is verified

How do i make this working?

$('<div />').attr('data-role', 'page')
.append($('<div>').attr('data-role', 'header')
if (item != '') .append('<a href="#"></a>')
.append('<img src="images/app/logo.png" id="navImg"/>')

the condition i want is "if variable item is not empty, append this..".

Thanks

Aucun commentaire:

Enregistrer un commentaire