Click here to Skip to main content
15,885,141 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi
can you please help me to remove this syntex error.

XML
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html>

<head>
    <meta http-equiv="Content-type" content="text/html;charset=UTF-8">
    <meta name="viewport" content="initial-scale=1.0,width=device-width,user-scalable=no,target-densitydpi=device-dpi" />
    <!--title>Expand table rows with jQuery - jExpand plugin - JankoAtWarpSpeed demos</title-->

 <!--script src="jquery.collapser.min.js" type="text/javascript"></script-->


    <style type="text/css">
      .hidden {
 visibility: hidden
}
    </style>
   <script src="jquery.min.js" type="text/javascript"></script>
 <!--script src="jquery.collapser.js" type="text/javascript"></script-->
    <script type="text/javascript">
    $('.label').onClick( make_visible );

make_visible () {
  var id = this.id;
  id += '_desc';
 $('.description').addClass('hidden'); //makes everything hidden again
 $('#'+id).removeClass('hidden'); //nunhides the selected label description.
}


    </script>
</head>
<body>

<div id='label_xx1' class='label'> Label 1</div><div id='label_xx1_desc' class='description hidden'>Description 1</div>
<div id='label_xx2' class='label'>Label 2</div><div id='label_xx2_desc' class='description hidden'>Description 2</div>
<div id='label_xx3' class='label'>Label 3</div><div id='label_xx3_desc' class='description hidden'>Description 3</div>
<div id='label_xx4' class='label'>Label 4</div><div id='label_xx4_desc' class='description hidden'>Description 4</div>


</body>
</html>
Posted
Comments
AmitGajjar 15-Sep-12 23:18pm    
where is the error ? on which line ?

hello,

Wrap it in document.ready and the correct syntax is

XML
<script type="text/javascript">
     $(document).ready(function () {
         $(".label").click(function () {
             var id = this.id;
             id += '_desc';
             $('.description').addClass('hidden'); //makes everything hidden again
             $('#' + id).removeClass('hidden'); //nunhides the selected label description.
         });

     });
</script>
 
Share this answer
 
v2
Hi,

The only issue i can see in your code is with the meta element,

You need to change your meta element,
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">

with
<meta http-equiv="Content-type" content="text/html;charset=UTF-8 "/>


So end tag is missing.

Hope this is what you looking for.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900