JSFiddle - React, Tailwind, and code Playground

by chauhangs

HTML

<table>
    <tr>
        <td>Question 1:</td>
        <td><strong>Occupational/technical/eduction/training program:</strong><br />
    Started before 1/1/12.<br />
            More text <i>description</i> more/text/with/slashes.</td>
        <td>Additional data</td>
    </tr>
    <tr>
        <td>Question 2:</td>
        <td>Possible lengthy data/that/includes/slashes, but no html tags</td>
        <td>Additional data</td>
    </tr>
</table>

CSS

table {border-collapse:collapse; border-top:1px solid #000; border-left:1px solid #000; }

table td {border-right:1px solid #000; border-bottom:1px solid #000; }

JavaScript

$("table tr td:nth-child(2)").each(function() {
    var tdContent = $(this).html();
    var slashSpace = tdContent.replace(/\//g, "/&nbsp;");
    $(this).html(slashSpace);
				    	
});