1

Basically, I want to have a <p> tag inserted after every </table> tag. My problem is that I have the ability to add javascript to an external thirdparty software but they dont allow me to edit the actual templates. I want every table to be on a new line and css styling the table tag to be display:block; does not work.

If anyone knows how to make sure every table is its own line using either javascript or css I would be very appreciative. If you think that my method might work and can whip up a quick script.

Marvin Pinto
  • 30,138
  • 7
  • 37
  • 54
Disguy
  • 39
  • 6

2 Answers2

1

Using jQuery you could do:

$("table").after("<p>");
duncan
  • 31,401
  • 13
  • 78
  • 99
  • 1
    What happens where there are 1000 hidden tables. This doesn't solve his problem, it adds to it. – Eric Hodonsky Jan 26 '12 at 22:09
  • @Relic: What is the problem with 1000 hidden tables? I realize this may not be what the OP actually needs. But the question was, how can I insert a

    after every

    – Ruan Mendes Jan 26 '12 at 22:20
  • then it has to do 1000 iterations of adding

    elements, and having that much more DOM work to traverse. If he uses just CSS there is no processing per element, it's style applied to all elements at once. And don't go getting browser technical on me about loading CSS, it's a style and you KNOW it's lighter weight than editing the DOM

    – Eric Hodonsky Jan 26 '12 at 22:22
  • @JuanMendes: The question also states *"using either javascript or css"*. ;) –  Jan 26 '12 at 22:27
  • @Relic, if he has 1000 hidden tables, he's got bigger problems to worry about! – duncan Jan 26 '12 at 22:33
  • @JuanMendes No kidding? are you sure about that? other then that fact that he's using tables at all, I don't see anything wrong with having 1000 elements on a page. Facebook anyone? – Eric Hodonsky Jan 26 '12 at 22:36
  • @Relic: I think your comment was directed towards duncan. But my point is that this answers the question. If the question is misguided, it's the OP's problem. – Ruan Mendes Jan 26 '12 at 23:15
  • @JuanMendes So basically you're more concerned with answering a question for your ranking than providing the best solution... I get it! – Eric Hodonsky Jan 26 '12 at 23:29
  • @Relic: It's not even my answer, I just voted it up. I do not care that much about the rep. I comment a lot more than I actually answer. I've run across many questions where people think they know what the OP wants and they answer the question in a completely different way and their assumptions about what the OP needed were wrong (what if there aren't 1000 tables?, what if OP wants text in the p tags?). Therefore, when you don't answer the question, you assume that the OP is not that smart and you know more than they do. I'd rather answer the question and suggest something else. – Ruan Mendes Jan 27 '12 at 00:07
  • @Relic: See http://stackoverflow.com/questions/8809265/get-current-selected-option/8809319#comment11020065_8809319 for an example of assuming you know what the OP wants – Ruan Mendes Jan 27 '12 at 00:11
  • @JuanMendes Dude... clearly, I was taking a little extra effort... to give a lighter weight solution, and you took it personal. Chill. And you should NEVER fix a asker's question, that's not what I did, I tried to adapt to it and offer a different solution to solve the problem he was describing. Just because my solution was different doesn't make it better. Well in this case it might, but like I said, you really need to chill. – Eric Hodonsky Jan 27 '12 at 17:50
  • @Relic: I didn't think I was being rude or anything, my apologies if it sounded that way. I was just explaining that we have different philosophies. You're the one who said you had the "misplaced passive aggressiveness", and you proved it again. – Ruan Mendes Jan 27 '12 at 19:24
1

oh, just use this css instead:

table{
   clear:left;
   float:left;
}
Eric Hodonsky
  • 5,617
  • 4
  • 26
  • 36