Thursday, January 15, 2015

get entered textbox value on keyup jquery

$(selector).keyup(function() {
  var textValue = $(this).val();
  DoX();
});

get value of textbox on keypress

$('#dSuggest').keypress(function() {
    var dInput = this.value;
    console.log(dInput);
    $(".dDimension:contains('" + dInput + "')").css("display","block");
});

jquery How can I get the value of a textbox in the current HTML table row?

$('.myLink').click(function(e){
   e.preventDefault();
   var val = $(this).closest('tr').find('.NameClass').val();
   // var val = $(this).parent().prev().find('.NameClass').val();
});

Tuesday, January 13, 2015

Click event in DOM example

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>click demo</title>
<style>
p {
color: red;
margin: 5px;
cursor: pointer;
}
p:hover {
background: yellow;
}
</style>
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
</head>
<body>
<p>First Paragraph</p>
<p>Second Paragraph</p>
<p>Yet one more Paragraph</p>
<script>
$( "p" ).click(function() {
$( this ).slideUp();
});
</script>
</body>
</html>