Pegar id e conteúdo de input com JQuery

<html>
<head>
<link rel="stylesheet" type="text/css" href="estilo.css" />
<script type="text/javascript" src="jquery-1.6.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
  $(":input").blur(function() {
    var id = $(this).attr('id');
    var value = $(this).val();
    alert(id + " " + " " + value);
  });
});
</script>
</head>

<body>
  <input type="text" id="nome">
  <input type="text" id="idade">
</body>
</html>
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s