0

I tried to wrap the following element with div container, if it is not wrap up with.

<p class="fileDetails"><div class="filename">text goes here</div><div class="fileSize">text goes here</div></p>

How to fix this?

double-beep
  • 5,031
  • 17
  • 33
  • 41
Vasethvan
  • 391
  • 1
  • 4
  • 12

2 Answers2

1

You can't put <div> elements inside of <p>s. (Down to the specs -- see also Putting <div> inside <p> is adding an extra <p> ) if you're interested.

So you'll have to switch to a <span> that's styled the way you want, or probably semantically an unordered list makes more sense.

Here's a fiddle showing how it could work.

Community
  • 1
  • 1
Graham Charles
  • 9,394
  • 3
  • 26
  • 41
0

Working Example: http://jsfiddle.net/ef43tgto/

You should make .filename and .fileSize <p> tags and the .fileDetails a <div>. Then you can use jQuery .wrap()

<div class="fileDetails">
    <p class="filename">text goes here</p>
    <p class="fileSize">text goes here</p>
</div>

if ( !$('.container').length ) {
    $('.fileDetails').wrap('<div class="container" />')
}
Scott L
  • 549
  • 1
  • 6
  • 13