Pergunta

I just wanted to know how to append multiple items on a div one inside another:

I want to recreate this inside the append but I don't know how to append multiple items in the:

<li class="listnone border_bottom_grey thin">
    <div class="circle"><i class="icon-pin"></i></div>
    <span class="grey bold inline quarter_padding_left">
    name variable would go here</span>
    <span class="small right white tag_price">price variable would go here</span></br>
    <span class="quarter_padding_top inline lightgrey small">
    <i class="icon-location-2 indent20 small"> </i> location variable would go here</span>
</li>

Javascript

function reDrawList (){
var price = $('#tag_price');
var location = $ ('#tag_location');
var name = $ ('#tag_name');

$( ".scrollable" ).after( [price, location, name]);
};
Foi útil?

Solução

You could use jQuery's .add() to chain them together into a single selector:

var $one = $('<li>one</li>');
var $two = $('<li>two</li>');
var $three = $('<li>three</li>');

$('ul').after($one.add($two).add($three));
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top