JavaScript DHTML/jQuery/next

Материал из Web эксперт
Версия от 10:24, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

Get next tag

   <source lang="html4strict">
   

<html>

 <head>
   <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
   <script type="text/javascript">
   $(document).ready(function(){
         $("input[name="me"]").next().text(" changed");
   });
   </script>
 </head>
 <body>
       <input type="radio" name="me" value="A" />
       data
       <input type="radio" name="me" value="B" />
         data
       <input type="radio" name="me" value="C" />
       data
 </body>

</html>



 </source>
   
  


Get next tag from selected one

   <source lang="html4strict">
   

<html>

 <head>
   <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
   <script type="text/javascript">
       $(document).ready(function(){
            $("button[disabled]").next().text("data");
       });
   </script>
   <style>
     .y { background:yellow; }
 </style>
 </head>
 <body>
   <body>
<button disabled="disabled">First</button> -
 </body>

</html>



 </source>
   
  


Next class

   <source lang="html4strict">
   

<html>

 <head>
   <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
   <script type="text/javascript">
       $(document).ready(function(){
            $("button[disabled]").next(".selected").text("data");
       });
   </script>
   <style>
     .y { background:yellow; }
 </style>
 </head>
 <body>
   <body>
<button disabled="disabled">First</button> -
 </body>

</html>



 </source>
   
  


next(expr)

   <source lang="html4strict">

<html>

 <head>
   <script type="text/javascript" src="js/jquery-1.3.2.js"></script>
   <script type="text/javascript">
       $(document).ready(function(){
                $("p").next().text("asdf");   
       });
   </script>
 </head>
 <body>
   <body>
       

bad or .

good
   </body>

</html>

 </source>