Jquery refer to initial element selector - Javascript jQuery

Javascript examples for jQuery:Tag Traversing

Description

Jquery refer to initial element selector

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.0.js"></script> 
  <script type="text/javascript">
    $(function(){/* w w  w  .  ja v a 2s . c  o m*/
$('.someclass').each(function(){
    $(this).next('span').append('<input class="textbox" name="'+$(this).attr("name")+'-x'+'"/>');
})
    });

      </script> 
 </head> 
 <body> 
  <span class="someclass"></span> 
  <span></span>  
 </body>
</html>

Related Tutorials