Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-09-2012, 05:32 PM   PM User | #1
asifakhtar
New Coder

 
Join Date: Feb 2009
Posts: 78
Thanks: 5
Thanked 0 Times in 0 Posts
asifakhtar is an unknown quantity at this point
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 05:45 PM.. Reason: formatted HTML
asifakhtar is offline   Reply With Quote
Old 05-09-2012, 05:47 PM   PM User | #2
VIPStephan
The fat guy next door


 
VIPStephan's Avatar
 
Join Date: Jan 2006
Location: Halle (Saale), Germany
Posts: 7,697
Thanks: 5
Thanked 875 Times in 850 Posts
VIPStephan is a jewel in the roughVIPStephan is a jewel in the roughVIPStephan is a jewel in the rough
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.
__________________
Don’t click this link!
VIPStephan is offline   Reply With Quote
Old 05-09-2012, 06:13 PM   PM User | #3
asifakhtar
New Coder

 
Join Date: Feb 2009
Posts: 78
Thanks: 5
Thanked 0 Times in 0 Posts
asifakhtar is an unknown quantity at this point
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 "_".
asifakhtar is offline   Reply With Quote
Old 05-10-2012, 08:58 PM   PM User | #4
asifakhtar
New Coder

 
Join Date: Feb 2009
Posts: 78
Thanks: 5
Thanked 0 Times in 0 Posts
asifakhtar is an unknown quantity at this point
Hi,
I have done it myself. Thanks VIPStephan for all your help.
asifakhtar is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:06 AM.


Advertisement
Log in to turn off these ads.