how to create Building HTML with list variable...
this my code error...
html
<div class="demo">
<!-- append code -->
</div>
css
.demo_btn_btn1 {
color :red;
}
.demo_btn_btn2 {
color :blue;
}
.demo_btn_btn3 {
color :orange;
}
jQuery code
$(function(){
var cls = ['btn1','btn2','btn3'],
txt = ['button1','button2','button3'],
html = [];
html = $('<button class="demo_btn_' + cls + '"><span>' + txt + '</span></button>');
$(".demo").append(html);
});
and this output my code
<div class="demo">
<button class="demo_btn_btn1,btn2,btn3">
<span>button1,button2,button3</span></button>
</div>
And i want this...
<div class="demo">
<button class="demo_btn_btn1"><span>Button1</span></button>
<button class="demo_btn_btn2"><span>Button2</span></button>
<button class="demo_btn_btn3"><span>Button3</span></button>
</div>
Please help me, thank you in advance