Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to concatenate two tags in phoenix framework?

What is the way to generate, let's say, two span elements inside a div element in a phoenix framework's view?

like image 996
NoDisplayName Avatar asked Sep 18 '15 03:09

NoDisplayName


1 Answers

In order to do that it's possible to just use an array and pass it inside as the div tag's value like this:

def div_with_spans do
  content_tag :div, class: "test" do
    [
      content_tag(:span, "foo"),
      content_tag(:span, "bar")
    ]
  end
end
like image 140
NoDisplayName Avatar answered Sep 28 '22 10:09

NoDisplayName



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!