jQuery doesn't support XPath selectors any more - you need to use CSS selectors.
$("p").addClass("jq"); --John On Dec 20, 9:36 am, "chinnakarup...@gmail.com" <chinnakarup...@gmail.com> wrote: > Hi, > I am trying XPATH selector with jquery....it doesn't seem to > work..find below the eg.it should select the paragraph. > can any tell me what I am missing. > > THnks > > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" > "http://www.w3.org/TR/html4/loose.dtd"> > <html xmlns="http://www.w3.org/1999/xhtml"> > <head> > <meta http-equiv="Content-Type" content="text/html; > charset=utf-8" /> > <title>New Web Project</title> > <style type='text/css'> > > .jq{ > background-color:red; > > } > > </style> > <script type="text/javascript" src="/lib/jquery/ > jquery.js"></script> > <script type="text/javascript"> > $(document).ready(function(){ > $("//p").addClass("jq") > }) > </script> > </head> > <body> > <h1>heading</h1> > <p>paragraph</p> > </body> > </html>