Help with Doctype and jquery selector

Help with Doctype and jquery selector

Hello, everyone, and please excuse my English.


I'm new to jquery and I have a small problem with the selectors.
In fact when I did not inform DOCTYPE in my code, the effect of opacity works fine. But when I say my DOCTYPE it looks like the selector $ (prev) and $ (next) no longer works.


Here is my code:


  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3.     <head>
  4.        
  5.         <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
  6.         <script type="text/javascript">
  7.             <!--
  8.             function initDiapo () {
  9.                 $(prev).fadeTo(0, 0.5, function () {$(prev).css('visibility', 'visible');});
  10.                 $(next).fadeTo(0, 0.5, function () {$(next).css('visibility', 'visible');});
  11.             }
  12.             //-->
  13.         </script>
  14.     </head>
  15.     <body onload="initDiapo()">
  16.             <div id="diapo">
  17.                 <img id="prev" src="./img/s_prev.jpg" alt="" style="visibility: hidden;" />
  18.                 <img id="next" src="./img/s_next.jpg" alt="" style="visibility: hidden;" />
  19.             </div>
  20.     </body>
  21. </html>

Thank you in advance for your help!


Good day!