Link to home
Start Free TrialLog in
Avatar of eaweb
eawebFlag for undefined

asked on

replace text and its hyperlink in a table

hi

i have attached table view being displayed from a source in a webpage. at the bottom of the table is a text that indicates disclaimer (it has its hyperlinks). i need to remove the text and its hyperlink for the following html formatted text:

<div style=text-align:right; border:none><FONT FACE=Arial SIZE=1 COLOR=000000>Quotes delayed at least 15 minutes. Market data provided by Interactive Data.</FONT></div>

how can i do this in javascript or ajax and have it working in IE, Firefox and chrome.
inv.jpg
Avatar of eaweb
eaweb
Flag of undefined image

ASKER

i am testing below ajax code but it doesn't work 100 percent.

using (jquery-1.7.1.min.js)

$(document).ready(function() {
      $(":contains('disclaimer'):last", "table").parents("td:first").html("<div style=text-align:right; border:none><FONT FACE=Arial SIZE=1 COLOR=000000>Quotes delayed at least 15 minutes. Market data provided by Interactive Data.</FONT></div>");
      });

without it everthing works fine even in firefox and chrome. with working fine i mean the data is being displayed with the disclaimer text.
when i try to use it to replace the disclaimer text it doesn't work in firefox or chrome and for anthor account it doesn't display the data..
Avatar of Proculopsis
Proculopsis

<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title> - jsFiddle demo</title>
 
  <script type='text/javascript' src='http://code.jquery.com/jquery-1.7.1.js'></script>
 
<style type='text/css'>
    .disclaimer { display: none; }
  </style>
 
<script type='text/javascript'>//<![CDATA[
$(function(){
$('#test').click(function() {
    $("a:contains(disclaimer)").replaceWith($(".disclaimer").toggle());
    $(this).attr({disabled: true});
});
});//]]>  

</script>


</head>
<body>
  <div class="disclaimer" style="text-align:right; border:none;"><FONT FACE=Arial SIZE=1 COLOR=000000>Quotes delayed at least 15 minutes. Market data provided by Interactive Data.</FONT></div>

<input id="test" type="button" value="Test" />

<a href="#">disclaimer</a><img src="http://filedb.experts-exchange.com/incoming/2012/03_w12/561331/inv.jpg" />
 
</body>
</html>
SOLUTION
Avatar of Mrunal
Mrunal
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of eaweb

ASKER

Proculopsis, the table row containing the disclaimer text didn't change.
Please find attached the script i am using. As you will see in the code, the table is being retrieved from another source.
Document2.txt
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of eaweb

ASKER

it's how i solved it