html - Converting paragraphs with breaks to columns using jQuery -


I need to process the HTML of the email messages and replace the HTML of the message in a simple table with rows and columns.

Below is a scenario in which I can not find any answer:

   & Lt; P class = "product description" & gt; Products: Brocade Pepple Pencil Dress & lt; Br / & gt; Quantity: 1 & lt; Br / & gt; Size: Size 12 & lt; Br / & gt; Color: Black & lt; Br / & gt; Price: GBP 50.00 & lt; Br / & gt; & Lt; / P & gt; & Lt; / TD & gt;  

I need to convert it to the following format:

  & lt; Td> & Lt; TD & gt; Products: Brocade Pepple Pencil Dress & lt; / Td> & Lt; TD & gt; Quantity: 1 & lt; / Td> & Lt; TD & gt; Size: Size 12 & lt; / Td> & Lt; TD & gt; Color: Black & lt; / Td> & Lt; TD & gt; Price: GBP 50.00 & lt; / Td> & Lt; / TD & gt;  

I will get rid of using opening inside the column, but I & lt; Br> / Code> with TD & lt; / Td> & Lt; Td> to & lt; Br> Trying to change does not work.

I have many similar scenarios and if I can be past from this point then it will be very helpful.

I think you want to create a new table inside that td Because you can not directly nested td ; You can try something like this:

  $ (document) .ready (function () {// Create table tags wrapping $ ('. ProductDetails'). Rap ​​(' & Lt; Table & gt; & lt; tr & gt; '); // P tag, and wrap each item with a TD $ (' productive description '). (). Opening (). Wrap (' & Lt; td & gt; '); // Remove TD which is a B element within $ (' TD '). Filter (function () {Return $ (this). Html () ===' & lt; Br <>   

Irf Chrome and Firefox was tested on


Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -