Advertisement
Raank

Clicar e enviar um atributo para o input

Mar 4th, 2014
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.34 KB | None | 0 0
  1. <a href="#" id="Esse ID">Teste</a><!-- CAPTURA O ID -->
  2.  
  3. <input id="estado" name="estado" value="" /><!-- Para onde deve ir o atributo "ID" do link -->
  4.  
  5. <script type="text/javascript">
  6. $(document).ready(function() {
  7.     $("a").click(function() {
  8.         var value_send = $(this).attr("id");
  9.         $("input#estado").value( value_send );
  10.     });
  11. )};
  12. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement