it doesn't work for me. I have used $(function() {
and $(document).ready(function() { but nothing works I'm using firefox 2.0.6 On 26 Set, 13:33, Remy Sharp <[EMAIL PROTECTED]> wrote: > You need to wrap the jQuery in a 'ready' method - otherwise your JS is > running before the DOM is ready: > > $(function () { > $("//[EMAIL PROTECTED]'2']").hide(); > $("//[EMAIL PROTECTED]'3']").hide(); > > }); > > Making this change works. > > On Sep 26, 10:45 am, julio <[EMAIL PROTECTED]> wrote: > > > Hi, > > > I have this simple html page: > > > <html> > > <head><title>A test page</title></head> > > <script type="text/javascript" src="jquery.js"></script> > > <body> > > <script> > > $("//[EMAIL PROTECTED]'2']").hide(); > > $("//[EMAIL PROTECTED]'3']").hide(); > > </script> > > <h1 myattr="1">test-row1</h1> > > another row > > <h1 myattr="1">test-row2</h1> > > <img myattr="2" src="pic1.png" /> > > <img myattr="2" src="pic2.png" /> > > <table myattr="3"> > > <tr myattr="4"> > > <td myattr="5">test</td> > > </tr> > > <tr myattr="4"> > > <td myattr="5">test</td> > > </tr> > > </table> > > </body> > > </html> > > > and I would like hide elements retrieved via xpath like in <script/>. > > > But it doesn't work > > > Why? Have you any idea? > > > Thanks, > > Julio