We help IT Professionals succeed at work.
Get Started

Javascript/JQuery not running in FF or Chrome

329 Views
Last Modified: 2013-11-23
I'm using a stylesheet to transform some XML.  The following code works fine in IE9 but the javascript does not work in FF or Chrome.  I need this to work with the JQuery Library embedded in the file.  The javascript following the library hides columns with no data in the table.

<?xml version="1.0"?>
<!--THE FOLLOWING STYLESHEET IS A DEFAULT TEMPLATE FOR ELIBILITY-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl"
	xmlns:hip="http://www.oopfactory.com/2011/XSL/Hipaa">
	<xsl:output method="html" doctype-system="http://www.w3.org/TR/html4/strict.dtd"
		doctype-public="-//W3C//DTD HTML 4.01//EN" indent="yes"/>
   


	<xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'"/>
	<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'"/>

	<xsl:template match="/">
      <xsl:comment> saved from url=(0014)about:internet </xsl:comment> 
   	  <xsl:text>&#10;&#13;</xsl:text> 

		<html>
       
			<head>                    
            <style>		

			  #section1Table {
				  width: 100%;
				  font-family:Tahoma, Geneva, sans-serif;
				  font-size:10px;
			  }
			  #providerTable {
				  width: 100%;
				  font-family:Tahoma, Geneva, sans-serif;
				  font-size:10px;
				  border-collapse:collapse;
				  text-align: center;
			  }
			  #subscriberTable, #dependentTable, #deductibleTable {
				  width: 100%;
				  font-family:Tahoma, Geneva, sans-serif;
				  font-size:9px;
				  border-collapse:collapse;
				  text-align: center;
			  }
			  .mainHeader {
				  background:#666;
				  color:#FFF;
				  font-size:12px;
			  }
			  .subHeader {
				  font-family:Tahoma, Geneva, sans-serif;
				  background:#CCCCCC;
				  color: #00F;
			  }
			  .pageHeader {
				  font-family:Tahoma, Geneva, sans-serif;
				  font-size:16px;
			  }
			  .pageHeader1 {
				  font-family:Tahoma, Geneva, sans-serif;
				  font-size:12px;
				  font-style: italic;
			  }
			  .subHeader2 {
				  font-family:Tahoma, Geneva, sans-serif;
				  color: #00F;
				  font-size:12px;
			  }
			  .subHeader3 {
				  font-family:Tahoma, Geneva, sans-serif;
				  color: #00F;
				  font-size:9px;
				  text-align: right;
				  background:#CCCCCC;
				  padding-right: 5px;
			  }
			  .subData2 {
				  font-family:Tahoma, Geneva, sans-serif;
				  font-size:12px;
			  }
			  .summaryTable, .summaryIndTable {
				  width: 100%;
				  font-family:Tahoma, Geneva, sans-serif;
				  font-size:9px;
				  border-collapse:collapse;
			  }
			  .mainHeader2 {
				  background:#666;
				  color:#FFF;
				  font-size:12px;
			  }
			  .subHeader3 {
				  font-family:Tahoma, Geneva, sans-serif;
				  background:#CCCCCC;
				  color: #00F;
				  text-align:center;
			  }
			  #requestValidationTable {
				  width: 100%;
				  font-family:Tahoma, Geneva, sans-serif;
				  font-size:12px;
				  border-collapse:collapse;
				  text-align: left;
			  }
			  .detailTable, #activecoverageTable {
				  width: 100%;
				  font-family:Tahoma, Geneva, sans-serif;
				  font-size:7px;
				  border-collapse:collapse;
				  text-align: center;
			  }
			  .summaryFamTable, .summaryIndTable {
				  display:inline;
				  width: 100%;
				  font-family:Tahoma, Geneva, sans-serif;
				  font-size:9px;
				  border-collapse:collapse;
				  display: -moz-inline-stack;
				  vertical-align:top;
			  }
			  p {
				  font-family:Tahoma, Geneva, sans-serif;
				  font-size:10px;
			  }
			  h5 {
				  font-family:Tahoma, Geneva, sans-serif;
			  }
			  th, tr, table {
				  border-collapse:collapse;
				  font-family:Tahoma, Geneva, sans-serif;
			  }

			</style>
				<title>Eligibilty Benefit Response</title>
				
				<script type="text/javascript">	
				<![CDATA[			
				[b]THIS IS WHERE I HAVE THE JQUERY LIBRARY[/b]
                                 ]]>			
				</script>


				<script type="text/javascript" language="javascript">
				
					  $(document).ready(function() {
   						$('.detailTable').each(function() {
       					$(this).find("th").each(function(i) {
            			var remove = true;
            			var tds = $(this).parents('table').find('tr td:nth-child(' + (i + 1) + ')');
            			if (tds.filter(":parent").length == 0) {
                		$(this).hide();
                		tds.hide();
						            }
						        });
						    });
						});
				</script> 			
			</head>

Open in new window

Comment
Watch Question
This problem has been solved!
Unlock 1 Answer and 7 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE