99
rated 0 times
[
101]
[
2]
/ answers: 1 / hits: 5637
/ 11 Years ago, mon, january 20, 2014, 12:00:00
hey guys im trying to change the text of a h1 with jquery. i want to change the text every time enter key is pressed in a text area and the values are numeric values like on first enter the text should be 1 and on other it should be 2 and so on.. This is the code which im using...
Jquery
<script>
$('#_co').bind('keypress', function(e) { //_co is the Id of Text area
var code = e.keyCode || e.which;
var id = 1;
if(code == 13) {
var text = $('#_line').text();
$('#_line').text(id);
id++;
}
});
</script>
Html
<h1 id=_line>0</h4>
More From » jquery