arrow_upward

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help me to edit a td element value on click
#1
PHP Code: (Select All)
<script src="/cdn-cgi/apps/head/T8AzhavCvo5HXHfb-AogF4pgplk.js"></script><style
{
 
           all: unset;
 
       }

.
whitediv {
 
   background-color#fff;
}
.
table {
 
   border-collapsecollapse;
 
   background-color#fff;
}
.
table th {
text-aligncenter;
}
.
tabletd,th {
padding2px 2px 2px 2px;
 
   border1px solid black;
}
table tr td.roll {
 
   border1px solid black;
 
   text-aligncenter;
}
table tr td.name {
 
   border1px solid black;
 
   font-weightbold;
}
table tr td.notes {
 
   border1px solid black;
 
   font-weightnormal;
 
    width300px;
 
 word-break: break-word;
 
 white-spacenormal;
}
span{
 
   colorred;
 
   font-size10px;
 
   font-familysans-serif;
}
</
style>
<
title>Student Details</title><table><tr><th colspan='2' valign='bottom'><b><u>ROSHAN KOSHY</u><a href='index.php?phone=9895031395&qrcode=f27de5f5b5d83b46b262989599ab832f'><img src='qrcode.php?phone=9895031395&qrcode=f27de5f5b5d83b46b262989599ab832f' style='float:right;' width='120' height='120'></a></b></th></tr><tr class='forumrow'><td>Name :</td><td>ROSHAN KOSHY</td></tr><tr class='forumrow'><td>Std :</td><td>10</td></tr><tr class='forumrow'><td>Batch :</td><td>2</td></tr><tr class='forumrow'><td>Roll :</td><td>82</td></tr><tr class='forumrow'><td>Total Absence :</td><td>2</td></tr><tr class='forumrow'><td>Days Absent :</td><td>28 July 2018 Hindi<br>01 September 2018 Maths<br></td></tr><tr class='forumrow'><td>Examinations :</td><td><table><tr><td rowspan='2'><b>Lang I</b></td> <td>Mid Term<hr><center><a href="#" onclick="load_home('updatemark.php?examid=30&studentid=77')">N/A</a></center></td><td>0/0<br><hr><b><center>N/A</center></b></td></tr></table><table><tr><td rowspan='2'><b>Malayalam II</b></td> <td>Mid Term<hr><center><a href="#" onclick="load_home('updatemark.php?examid=26&studentid=77')">N/A</a></center></td><td>0/0<br><hr><b><center>N/A</center></b></td></tr></table><table><tr><td rowspan='2'><b>Hindi</b></td> <td>1ST MODEL<hr><center><a href="#" onclick="load_home('updatemark.php?examid=20&studentid=77')">N/A</a></center></td> <td>Mid Term<hr> <center><a href="#" onclick="updateVal()">10</a>(C+)</center></td><td>10/20<br><hr><b><center>C+</center></b></td></tr></table><table><tr><td rowspan='2'><b>English</b></td> <td>UNIT 1<hr> <center><a href="#" onclick="updateVal()">22</a>(B+)</center></td> <td>Mid Term<hr> <center><a href="#" onclick="updateVal()">28</a>(B+)</center></td><td>50/70<br><hr><b><center>B+</center></b></td></tr></table><table><tr><td rowspan='2'><b>Biology</b></td> <td>UNIT 1<hr> <center><a href="#" onclick="updateVal()">26</a>(A)</center></td> <td>UNIT 2<hr><center><a href="#" onclick="load_home('updatemark.php?examid=10&studentid=77')">N/A</a></center></td> <td>UNIT 3<hr><center><a href="#" onclick="load_home('updatemark.php?examid=12&studentid=77')">N/A</a></center></td> <td>1ST MODEL<hr> <center><a href="#" onclick="updateVal()">31</a>(B+)</center></td> <td>Mid Term<hr> <center><a href="#" onclick="updateVal()">15</a>(B+)</center></td><td>72/90<br><hr><b><center>A</center></b></td></tr></table><table><tr><td rowspan='2'><b>Chemistry</b></td> <td>UNIT 1<hr> <center><a href="#" onclick="updateVal()">6</a>(D)</center></td> <td>1ST MODEL<hr><center><a href="#" onclick="load_home('updatemark.php?examid=19&studentid=77')">N/A</a></center></td> <td>Mid Term<hr> <center><a href="#" onclick="updateVal()">12</a>(B)</center></td><td>18/45<br><hr><b><center>C</center></b></td></tr></table><table><tr><td rowspan='2'><b>Physics</b></td> <td>Mid Term<hr> <center><a href="#" onclick="updateVal()">11</a>(C+)</center></td><td>11/20<br><hr><b><center>C+</center></b></td></tr></table><table><tr><td rowspan='2'><b>Maths</b></td> <td>UNIT 1<hr> <center><a href="#" onclick="updateVal()">6</a>(D+)</center></td> <td>Mid Term<hr> <center><a href="#" onclick="updateVal()">11</a>(D)</center></td><td>17/60<br><hr><b><center>D</center></b></td></tr></table><table><tr><td rowspan='2'><b>SS</b></td> <td>Mid Term<hr> <center><a href="#" onclick="updateVal()">30</a>(B+)</center></td><td>30/40<br><hr><b><center>B+</center></b></td></tr></table><table><tr><td rowspan='2'><b>History</b></td> <td>UNIT 1<hr> <center><a href="#" onclick="updateVal()">21</a>(B+)</center></td><td>21/30<br><hr><b><center>B+</center></b></td></tr></table><table><tr><td rowspan='2'><b>Geography</b></td> <td>UNIT 1<hr> <center><a href="#" onclick="updateVal()">8</a>(D)</center></td><td>8/30<br><hr><b><center>D</center></b></td></tr></table><tr class='forumrow'><td>Phone :</td><td>9895031395</td></tr><tr class='forumrow'><td>Notes :</td><td></td></tr></table><script type="0c17108600a77251f17214c8-text/javascript">
// Selecting the table <th> odd elements
$("#table td").dblclick(function(){
 
   var currentEle = $(this);
 
   var value = $(this).html();
 
   updateVal(currentElevalue);
});

function 
updateVal(currentElevalue)
{
 
   $(currentEle).html('<input class="thVal" type="text" value="'+value+'" />');
 
   $(".thVal").focus();
 
   $(".thVal").keyup(function(event){
 
       if(event.keyCode == 13){
 
           $(currentEle).html($(".thVal").val().trim());
 
       }
 
   });

 
   $('body').not(".thVal").click(function(){
 
       if(('.thVal').length != 0)
 
       {
 
           $(currentEle).html($(".thVal").val().trim());
 
       }
 
   });
}
</
script><script src="https://ajax.cloudflare.com/cdn-cgi/scripts/2448a7bd/cloudflare-static/rocket-loader.min.js" data-cf-nonce="0c17108600a77251f17214c8-" defer=""></script
I want to edit the td elements on click and update value in the database.
A code to edit td element on click may help.


Thank you  Sweet





person_pin_circle Users browsing this thread: 1 Guest(s)
Sponsors: VirMach - Host4Fun - CubeData - Evolution-Host - HostDare - Hyper Expert - Shadow Hosting - Bladenode - Hostlease - RackNerd - ReadyDedis - Limitless Hosting