How to enter an input when clicking on a td with jquery or javascript? [closed]

0

I have a hidden input in a td and I want to click on the td appear (this I already do) and appear the cursor within the input without having to click again, to edit the input?

    
asked by Acd 19.06.2017 в 15:16
source

1 answer

2

From what I understand what you want to do, it's something similar to this.

$(document).ready(function(){
  $("table").click(function(){
    $("#idTxt").show();
    $("#idTxt").focus();
  });
});

function desaparecer(){
  $("#idTxt").hide();
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<table border="1" style="width: 100%;">
<tr>
<td>a</td>
<td>b</td>
</tr>
<tr>
<td>c</td>
<td>d</td>
</tr>
<tr>
<td colspan="2">
<input id="idTxt" value="" type="text" hidden="" onblur="desaparecer()">
</td>
</tr>
</table>
<br><br>

If you have any questions, let me know by comment!

    
answered by 19.06.2017 / 15:32
source