Show comma in html only if the variable has value using jquery?

illspirit

New Member
I have a table like this:\[code\]<table class="table table-bordered"> <thead> <tr> <th></th> <th>Project Name</th> <th>Tape-ID</th> <th>Video Type</th> <th>Date Created</th> <th>Director</th> <th>Camera Person</th> <th>Editor</th> <th>Tag</th> </tr> </thead> <tbody> {% load endless %} {% paginate 8 a %} {% for choice, i in a %} <tr> <td><input type="checkbox" name="choice" id="choice{{ forloop.counter }}" value="http://stackoverflow.com/questions/15761626/{{ choice.id }}" onchange="checkChecked()" /></td> <td>{{ choice.name }}</td> <td>{{ choice.tape_id }} </td> <td>{{ choice.video_type }}</td> <td>{{ i }}</td> <td>{{ choice.director }}</td> <td>{{ choice.cameraman }}</td> <td>{{ choice.editor }}</td> <td>{{ choice.tag1 }}, {{ choice.tag2 }}, {{ choice.tag3 }}, {{ choice.tag4 }}, {{ choice.tag5 }}, {{ choice.tag6 }}, {{ choice.tag7 }}, {{ choice.tag8 }}, {{ choice.tag9 }}, {{ choice.tag10 }} </td> </tr> {% endfor %} </tbody> </table> \[/code\]These variable \[code\]{{ choice...}}\[/code\] may or may not have value. It is sequential though. The variable upto 3 can have values and none of have values after 3. If there's no value it comes like this:\[code\]water, pollution, hello, , , , , ,\[/code\]I don't want to show comma if there's no value. How can I do this?
 
Back
Top