Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Feb 2009
    Posts
    121
    Thanks
    7
    Thanked 0 Times in 0 Posts

    How can I replace all “_“ in second td’s text of every row with a space using Jquery?

    Hi,
    I am getting the following html from a query result. Remember result is a string.
    Code:
    <table width=100% border=0 cellpadding=0 cellspacing=0>
    	<tr>
    		<th class=Sub>#</th>
    		<th class=Sub>File Name</th>
    		<th class=Sub>Size</th>
    		<th class=Sub>Date</th>
    	</tr>
    	<tr>
    		<td width=40 align=right class=Data1>1.</td>
    		<td class=Data1><a target=_blank href="/files/spool/404048/1075954/80_1267615_1075954/Sivaratnam_Suthakaran,_Dr._Peter_Cobrin,_Jan_20_2012,_IME_Guideline_Kit.pdf">Sivaratnam_Suthakaran,_Dr._Peter_Cobrin,_Jan_20_2012,_IME_Guideline_Kit.pdf</a>&nbsp;</td>
    		<td align=right width=85 class=Data1>22 KB</td>
    		<td align=right width=140 class=Data1>02/04/2012 8:5am</td>
    	</tr>
    </table>
    How can I replace all “_“ in second td’s text of every row with a space using Jquery?
    Thanks
    Last edited by VIPStephan; 05-09-2012 at 06:45 PM. Reason: formatted HTML

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,928
    Thanks
    6
    Thanked 1,041 Times in 1,014 Posts
    Formatting your code a little makes it a lot easier for us to read it. I’ve done that now in your post but keep that in mind for the future.

    Now, why do you wanna remove these underscores at all when it’s the exact file name? And if you really insist in doing this then it should be done server-side. The script that returns the query could easily be adapted to replace these underscores with whitespaces.

  • #3
    Regular Coder
    Join Date
    Feb 2009
    Posts
    121
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by VIPStephan View Post
    Formatting your code a little makes it a lot easier for us to read it. I’ve done that now in your post but keep that in mind for the future.

    Now, why do you wanna remove these underscores at all when it’s the exact file name? And if you really insist in doing this then it should be done server-side. The script that returns the query could easily be adapted to replace these underscores with whitespaces.
    I can't make changes to the server side method. The link's text is longer than td's width and it doesn't wrap because of "_".

  • #4
    Regular Coder
    Join Date
    Feb 2009
    Posts
    121
    Thanks
    7
    Thanked 0 Times in 0 Posts
    Hi,
    I have done it myself. Thanks VIPStephan for all your help.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •