Home > OS >  jQuery doesn't output proper HTML
jQuery doesn't output proper HTML

Time:09-17

I have a very old Rails 3 project I'm maintaining, to which I need to add new functionality. Primarily responsiveness with Bootstrap 4.

This is what I actually want to create: jquery segment

CodePudding user response:

You can add ' when you build the li.

"<li class='"   li_class   "'>"   list_details_html   "</li>"

as you can see in the example, I've added a console log, it returns <li class=list-group-item card-list-best>test</li> so if there no " or ' after class= then it will take the value after = and until the first space, so it would return <li class="list-group-item">test</li>

Working example

  • Related