javascript - onblur functionality for TR -


what can simulate or use onblur functionality tr.

here's jsfiddle http://jsfiddle.net/davomarti/4l859p5t/2/

<table>   <tr id="view_1" onclick="showeditrow( '1' )"`enter code here`>     <td>val1_1</td>     <td>val1_2</td>     <td>val1_3</td>   </tr>   <tr id="edit_1" style="display:none" onblur="showviewrow( '1' )">     <td><input type="text" value="val1_1"/></td>     <td><input type="text" value="val1_2"/></td>     <td><input type="text" value="val1_3"/></td>   </tr>   <tr id="view_2" onclick="showeditrow( '2' )">     <td>val2_1</td>     <td>val2_2</td>     <td>val2_3</td>   </tr>   <tr id="edit_2" style="display:none" onblur="showviewrow( '2' )">     <td><input type="text" value="val2_1"/></td>     <td><input type="text" value="val2_2"/></td>     <td><input type="text" value="val2_3"/></td>   </tr> </table>  function showeditrow( rowid ) {     var editelemid = "#edit_" + rowid;     var viewelemid = "#view_" + rowid;      $(viewelemid).hide();     $(editelemid).show(); }  function showviewrow(rowelem) {     var editelemid = "#edit_" + rowid;     var viewelemid = "#view_" + rowid;      $(viewelemid).show();     $(editelemid).hide(); } 

i have coded onblur tr , know doesn't work tr.

i want click on row , edit boxes replace text, when click out of row, want edit boxes replaced text tr.

since using jquery, rid of onblur on <tr> tags. then, code ...

$("tr").on('click', function() {   // enable fields , disable text here   // using $(this).find(".text").hide() }); 

as stated in comments, should not connect directly <tr> tag, class attached them can limit down elements need connect to.

you ...

$("body").on('click', "tr.pseudoclass", function() {   // enable fields , disable text here   // using $(this).find(".text").hide() }); 

... allow dynamic insertion of code without breaking.


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -