Wrapping elements inside a div tag using jQuery -


I use jQuery with & lt; Div & gt; I'm trying to wrap some elements inside the tag. / P>

I first add a composite cover, then a header element and then a span element. I am trying to wrap headers and durations in a container diva, I have followed some posts here and have read through docs, but it does not have difficulty working, at present it looks like this: / p>

  $ (response data) .each (function (i) {var country = this commanding; var subtitles = this.subTitle; var $ mainWrapper = $ ('& lt; div / & gt; '' addClass ('mainWrap'); $ MainWrapper.append ($ ('& lt; h4 / & gt;'.) Text (countryN); $ mainWrapper.append ($ ('& lt; span / & gt; '.) Text (subtitle) .addClass (' subT ');})   

whose As a result:

  & lt; Div class = "mainwrap" & gt; & Lt; h4 & gt; United States & lt; / H4 & gt; & Lt; Span class = "subT" & gt; $ 12.1563m, DAC = 01/01/2013 & lt; / Span & gt; & Lt; / Div & gt;   

What I'm trying to achieve is this structure:

  & lt; Div class = "mainwrap" & gt; & Lt; Div class = "countrywide" & gt; & Lt; h4 & gt; United States & lt; / H4 & gt; & Lt; Span class = "subT" & gt; $ 12.1563m, DAC = 01/01/2013 & lt; / Span & gt; & Lt; / Div & gt; & Lt; / Div & gt;   

My page has several sections (each of them from its main instrument), all of which have been tried to wrap, but wrapping both headers and subtitles , So I'm not sure how to select them (if it's the best way to go about it)

I'm guessing that you want more than one country inside the main window, that mother In Malé, you have to make a main warp outside of each loop.

  var $ mainWrapper = $ ('& lt; div / & gt;') addClass ('mainWrap'); $ (Response data) .each (function (i) {var country = this commanding; var subtitle = it subTitle; var $ countryWrapper = $ ('


Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -