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).attr('value');
    alert(id + " " + " " + value);
  });
});
</script>
</head>
<body>
    <p><input type="text" id="nome"></p>
    <p><input type="text" id="idade"></p>
</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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s