table content editable event












0














Is there an event on table row content editable to get the value once the user press enter or the focus on edited cell has been loose. I'm just wondering if the user can modify on cell as much as he want and when he is done there is something like a button that apply the changes and do the one time update query on the table.



Currently I have table like this:



<table class="sortable" border="1" id="myTable" >
<thead>
<tr>
<th>ID No</th>
<th>Sec ID</th>
<th>Employee</th>
<th>Dept</th>
<th>Code</th>
<th>Train</th>
<th>Cert</th>
<th>Prog</th>
<th>Date</th>
</tr>
</thead>
<tbody>
@foreach (var item in details)
{
<tr>
<td>@item.ID</td>
<td contenteditable='true' bgcolor="#F0F0F0">@item.secID</td>
<td>@item.name </td>
<td>@item.dept </td>
<td contenteditable='true' bgcolor="#F0F0F0">@item.Code </td>
<td contenteditable='true' bgcolor="#F0F0F0">@item.train </td>
<td contenteditable='true' bgcolor="#F0F0F0">@item.cert </td>
<td contenteditable='true' bgcolor="#F0F0F0">@item.prog </td>
<td>@item.date </td>
</tr>
}
</tbody>
</table>


I just want to collect the edited rows and store it on variable or list and pass it to my update query via ajax.



Any suggestions/comments TIA.










share|improve this question






















  • You can use $('#yourId').on('blur' , function(){} to start a function when you loose focus
    – Matt.S
    Nov 13 '18 at 6:55










  • where can I put this on ready function or will I add onclick event to td?
    – Rock n' Roll
    Nov 13 '18 at 7:48










  • put it in a script tag at the bottom but still inside of your <body>
    – Matt.S
    Nov 13 '18 at 8:35
















0














Is there an event on table row content editable to get the value once the user press enter or the focus on edited cell has been loose. I'm just wondering if the user can modify on cell as much as he want and when he is done there is something like a button that apply the changes and do the one time update query on the table.



Currently I have table like this:



<table class="sortable" border="1" id="myTable" >
<thead>
<tr>
<th>ID No</th>
<th>Sec ID</th>
<th>Employee</th>
<th>Dept</th>
<th>Code</th>
<th>Train</th>
<th>Cert</th>
<th>Prog</th>
<th>Date</th>
</tr>
</thead>
<tbody>
@foreach (var item in details)
{
<tr>
<td>@item.ID</td>
<td contenteditable='true' bgcolor="#F0F0F0">@item.secID</td>
<td>@item.name </td>
<td>@item.dept </td>
<td contenteditable='true' bgcolor="#F0F0F0">@item.Code </td>
<td contenteditable='true' bgcolor="#F0F0F0">@item.train </td>
<td contenteditable='true' bgcolor="#F0F0F0">@item.cert </td>
<td contenteditable='true' bgcolor="#F0F0F0">@item.prog </td>
<td>@item.date </td>
</tr>
}
</tbody>
</table>


I just want to collect the edited rows and store it on variable or list and pass it to my update query via ajax.



Any suggestions/comments TIA.










share|improve this question






















  • You can use $('#yourId').on('blur' , function(){} to start a function when you loose focus
    – Matt.S
    Nov 13 '18 at 6:55










  • where can I put this on ready function or will I add onclick event to td?
    – Rock n' Roll
    Nov 13 '18 at 7:48










  • put it in a script tag at the bottom but still inside of your <body>
    – Matt.S
    Nov 13 '18 at 8:35














0












0








0







Is there an event on table row content editable to get the value once the user press enter or the focus on edited cell has been loose. I'm just wondering if the user can modify on cell as much as he want and when he is done there is something like a button that apply the changes and do the one time update query on the table.



Currently I have table like this:



<table class="sortable" border="1" id="myTable" >
<thead>
<tr>
<th>ID No</th>
<th>Sec ID</th>
<th>Employee</th>
<th>Dept</th>
<th>Code</th>
<th>Train</th>
<th>Cert</th>
<th>Prog</th>
<th>Date</th>
</tr>
</thead>
<tbody>
@foreach (var item in details)
{
<tr>
<td>@item.ID</td>
<td contenteditable='true' bgcolor="#F0F0F0">@item.secID</td>
<td>@item.name </td>
<td>@item.dept </td>
<td contenteditable='true' bgcolor="#F0F0F0">@item.Code </td>
<td contenteditable='true' bgcolor="#F0F0F0">@item.train </td>
<td contenteditable='true' bgcolor="#F0F0F0">@item.cert </td>
<td contenteditable='true' bgcolor="#F0F0F0">@item.prog </td>
<td>@item.date </td>
</tr>
}
</tbody>
</table>


I just want to collect the edited rows and store it on variable or list and pass it to my update query via ajax.



Any suggestions/comments TIA.










share|improve this question













Is there an event on table row content editable to get the value once the user press enter or the focus on edited cell has been loose. I'm just wondering if the user can modify on cell as much as he want and when he is done there is something like a button that apply the changes and do the one time update query on the table.



Currently I have table like this:



<table class="sortable" border="1" id="myTable" >
<thead>
<tr>
<th>ID No</th>
<th>Sec ID</th>
<th>Employee</th>
<th>Dept</th>
<th>Code</th>
<th>Train</th>
<th>Cert</th>
<th>Prog</th>
<th>Date</th>
</tr>
</thead>
<tbody>
@foreach (var item in details)
{
<tr>
<td>@item.ID</td>
<td contenteditable='true' bgcolor="#F0F0F0">@item.secID</td>
<td>@item.name </td>
<td>@item.dept </td>
<td contenteditable='true' bgcolor="#F0F0F0">@item.Code </td>
<td contenteditable='true' bgcolor="#F0F0F0">@item.train </td>
<td contenteditable='true' bgcolor="#F0F0F0">@item.cert </td>
<td contenteditable='true' bgcolor="#F0F0F0">@item.prog </td>
<td>@item.date </td>
</tr>
}
</tbody>
</table>


I just want to collect the edited rows and store it on variable or list and pass it to my update query via ajax.



Any suggestions/comments TIA.







javascript html ajax






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 13 '18 at 6:24









Rock n' Roll

413722




413722












  • You can use $('#yourId').on('blur' , function(){} to start a function when you loose focus
    – Matt.S
    Nov 13 '18 at 6:55










  • where can I put this on ready function or will I add onclick event to td?
    – Rock n' Roll
    Nov 13 '18 at 7:48










  • put it in a script tag at the bottom but still inside of your <body>
    – Matt.S
    Nov 13 '18 at 8:35


















  • You can use $('#yourId').on('blur' , function(){} to start a function when you loose focus
    – Matt.S
    Nov 13 '18 at 6:55










  • where can I put this on ready function or will I add onclick event to td?
    – Rock n' Roll
    Nov 13 '18 at 7:48










  • put it in a script tag at the bottom but still inside of your <body>
    – Matt.S
    Nov 13 '18 at 8:35
















You can use $('#yourId').on('blur' , function(){} to start a function when you loose focus
– Matt.S
Nov 13 '18 at 6:55




You can use $('#yourId').on('blur' , function(){} to start a function when you loose focus
– Matt.S
Nov 13 '18 at 6:55












where can I put this on ready function or will I add onclick event to td?
– Rock n' Roll
Nov 13 '18 at 7:48




where can I put this on ready function or will I add onclick event to td?
– Rock n' Roll
Nov 13 '18 at 7:48












put it in a script tag at the bottom but still inside of your <body>
– Matt.S
Nov 13 '18 at 8:35




put it in a script tag at the bottom but still inside of your <body>
– Matt.S
Nov 13 '18 at 8:35












1 Answer
1






active

oldest

votes


















0














You could just use this on change event handler:



document.getElementById("myTable").addEventListener("change", function(event) {
//do whatever
})





share|improve this answer





















  • where can I put this? on ready function or will I add onclick event to td?
    – Rock n' Roll
    Nov 13 '18 at 7:48










  • You can put it wherever you want, it'll work perfectly.
    – Jack Bashford
    Nov 13 '18 at 7:49











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53274997%2ftable-content-editable-event%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














You could just use this on change event handler:



document.getElementById("myTable").addEventListener("change", function(event) {
//do whatever
})





share|improve this answer





















  • where can I put this? on ready function or will I add onclick event to td?
    – Rock n' Roll
    Nov 13 '18 at 7:48










  • You can put it wherever you want, it'll work perfectly.
    – Jack Bashford
    Nov 13 '18 at 7:49
















0














You could just use this on change event handler:



document.getElementById("myTable").addEventListener("change", function(event) {
//do whatever
})





share|improve this answer





















  • where can I put this? on ready function or will I add onclick event to td?
    – Rock n' Roll
    Nov 13 '18 at 7:48










  • You can put it wherever you want, it'll work perfectly.
    – Jack Bashford
    Nov 13 '18 at 7:49














0












0








0






You could just use this on change event handler:



document.getElementById("myTable").addEventListener("change", function(event) {
//do whatever
})





share|improve this answer












You could just use this on change event handler:



document.getElementById("myTable").addEventListener("change", function(event) {
//do whatever
})






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 13 '18 at 7:24









Jack Bashford

5,71631235




5,71631235












  • where can I put this? on ready function or will I add onclick event to td?
    – Rock n' Roll
    Nov 13 '18 at 7:48










  • You can put it wherever you want, it'll work perfectly.
    – Jack Bashford
    Nov 13 '18 at 7:49


















  • where can I put this? on ready function or will I add onclick event to td?
    – Rock n' Roll
    Nov 13 '18 at 7:48










  • You can put it wherever you want, it'll work perfectly.
    – Jack Bashford
    Nov 13 '18 at 7:49
















where can I put this? on ready function or will I add onclick event to td?
– Rock n' Roll
Nov 13 '18 at 7:48




where can I put this? on ready function or will I add onclick event to td?
– Rock n' Roll
Nov 13 '18 at 7:48












You can put it wherever you want, it'll work perfectly.
– Jack Bashford
Nov 13 '18 at 7:49




You can put it wherever you want, it'll work perfectly.
– Jack Bashford
Nov 13 '18 at 7:49


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53274997%2ftable-content-editable-event%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Xamarin.iOS Cant Deploy on Iphone

Glorious Revolution

Dulmage-Mendelsohn matrix decomposition in Python