There is a table. It is necessary to insert the Input box , only to certain td tags.

How to describe the condition?

 $(function() { $('td').click(function(e) { //ловим элемент, по которому кликнули var t = e.target || e.srcElement; //получаем название тега var elm_name = t.tagName.toLowerCase(); //если это инпут - ничего не делаем if(elm_name == 'input') {return false;} var val = $(this).html(); var code = '<input type=text id=\"edit\" value='+val+' />'; $(this).empty().append(code); $('#edit').focus(); $('#edit').blur(function() { var val = $(this).val(); $(this).parent().empty().html(val); }); }); }); 
  • Solved the problem: $(function() { $('td Class_name ').click(function(e) - A_Chernitsov
  • in general, so-for the future, look angularjs-there it can be done in just one line ... - Rakzin Roman
  • @A_Chernitsov, make your comment a response - Alexandr Tovmach 5:17 pm

0