Click here to Skip to main content
15,878,316 members
Home / Discussions / JavaScript
   

JavaScript

 
AnswerRe: JS Object Remove Duplicates Pin
W Balboos, GHB9-Aug-16 5:06
W Balboos, GHB9-Aug-16 5:06 
AnswerRe: JS Object Remove Duplicates Pin
Beginner Luck14-Aug-16 19:59
professionalBeginner Luck14-Aug-16 19:59 
QuestionAdd query columns to output (see code) Pin
Stavros McGillicuddy7-Aug-16 11:15
Stavros McGillicuddy7-Aug-16 11:15 
AnswerRe: Add query columns to output (see code) Pin
Nathan Minier8-Aug-16 1:30
professionalNathan Minier8-Aug-16 1:30 
QuestionUnexpected Identifier error Pin
Stavros McGillicuddy6-Aug-16 11:02
Stavros McGillicuddy6-Aug-16 11:02 
QuestionRe: Unexpected Identifier error Pin
Richard Deeming8-Aug-16 1:38
mveRichard Deeming8-Aug-16 1:38 
Questionchange in cell content of salary or bonus or deduction in table cells automatically affect in total Pin
ahmed_sa30-Jul-16 6:39
ahmed_sa30-Jul-16 6:39 
Questionget the value of row before changing in table if cancel click Pin
ahmed_sa25-Jul-16 7:13
ahmed_sa25-Jul-16 7:13 
in my code below i can edit row success without any error but if i need to cancel value edited in row OR get value before changed what i write to cancel edit in row in table by using jquery my code as following

<br />
@{<br />
    Layout = null;<br />
}<br />
<br />
<!DOCTYPE html><br />
<br />
<html><br />
<head><br />
    <meta name="viewport" content="width=device-width" /><br />
    <title>Index</title><br />
    <script src="~/Scripts/jquery-1.10.2.js"></script><br />
    <script><br />
      <br />
        $(function () {<br />
            $("#btn").click(function ()<br />
            {<br />
                var x = $("#txt1").val();<br />
                var y = $("#txt2").val();<br />
                var z = $("#mycountry").val();<br />
                $("#tb").append("<tr> <td>" + x + "</td> <td>" + y + "</td> <td>" + z + "</td><td> <input type='button'class='c' value='Delete'/></td><td> <input type='button' class='d' value='Edit'/></td><td><input type='button' class='e' value='Cancel'/></td></tr>");<br />
              <br />
<br />
            });<br />
            $("#tb").on("click", ".c", function () {<br />
                //$(this).parent().parent().remove();<br />
                $(this).closest('tr').remove();<br />
            });<br />
            $("#tb").on("click", ".d", function () {<br />
               var row = $(this).closest('tr').toggleClass("editing");<br />
               row.find("td").slice(0, 2).prop("contenteditable", row.hasClass("editing"));<br />
              var myselect = '<select id="mycountr1" name="mycountry1">' +<br />
               '<option>---select---</option>' + '<option>Egypt</option>' + '<option>qatar</option>' + '<option>saudia</option>' + '<option>emarates</option>'<br />
              '</select>';<br />
              var dropcountry = $(this).parent().prev().prev().text;<br />
              $(this).parent().prev().prev().html(myselect);<br />
               <br />
                //$('#tb').append(myselect);<br />
                //  $("#tb").children().children().eq(3).children().eq(3).append("myselect");<br />
                <br />
            });<br />
            $("#btndis").on('click', function () {<br />
                $("body").append("<ul id='listNames''></ul>");<br />
                $('#tb td:nth-child(2)').each(function () {<br />
                    $("#listNames").append("<li>" + $(this).text() + "</li>")<br />
                });<br />
            });<br />
            <br />
<br />
        });<br />
    </script><br />
   <br />
    <style><br />
        .editing {<br />
            background: yellow;<br />
        }<br />
    </style><br />
</head><br />
<body><br />
    <div><br />
        ID<input type="text" id="txt1" /><br /><br />
        Name<input type="text" id="txt2" /><br /><br />
        Country: <select id="mycountry"><br />
    <option>---select---</option><br />
    <option>Egypt</option><br />
    <option>qatar</option><br />
    <option>saudia</option><br />
    <option>emarates</option><br />
</select><br /><br />
        <input type="button" value="add" id="btn" /><br />
        <input type="button" value="display" id="btndis" /><br />
<br />
        <table><br />
            <thead><br />
                <tr><br />
                    <td><br />
                        ID<br />
                    </td><br />
                    <td><br />
                        Name<br />
                    </td><br />
                    <td><br />
                        Country<br />
                    </td><br />
                    <td><br />
                </tr><br />
            </thead><br />
            <tbody id="tb"></tbody><br />
        </table><br />
    </div><br />
</body><br />
</html><br />

QuestionCode is not working correctly Pin
Member 1265075924-Jul-16 2:31
Member 1265075924-Jul-16 2:31 
SuggestionRe: Code is not working correctly Pin
Richard MacCutchan24-Jul-16 2:48
mveRichard MacCutchan24-Jul-16 2:48 
AnswerRe: Code is not working correctly Pin
John C Rayan27-Jul-16 22:20
professionalJohn C Rayan27-Jul-16 22:20 
Questionneed help understanding how regular updating of a div works Pin
Member 1263409813-Jul-16 16:55
Member 1263409813-Jul-16 16:55 
AnswerRe: need help understanding how regular updating of a div works Pin
John C Rayan15-Jul-16 0:12
professionalJohn C Rayan15-Jul-16 0:12 
AnswerRe: need help understanding how regular updating of a div works Pin
ZurdoDev15-Jul-16 2:26
professionalZurdoDev15-Jul-16 2:26 
QuestionNeed help understanding this piece of code Pin
Jaime Premy10-Jul-16 5:53
professionalJaime Premy10-Jul-16 5:53 
AnswerRe: Need help understanding this piece of code Pin
ZurdoDev15-Jul-16 2:31
professionalZurdoDev15-Jul-16 2:31 
GeneralRe: Need help understanding this piece of code Pin
Jaime Premy15-Jul-16 5:21
professionalJaime Premy15-Jul-16 5:21 
GeneralRe: Need help understanding this piece of code Pin
ZurdoDev15-Jul-16 5:26
professionalZurdoDev15-Jul-16 5:26 
GeneralRe: Need help understanding this piece of code Pin
Jaime Premy16-Jul-16 18:22
professionalJaime Premy16-Jul-16 18:22 
GeneralRe: Need help understanding this piece of code Pin
ZurdoDev17-Jul-16 8:19
professionalZurdoDev17-Jul-16 8:19 
QuestionWhat is the work of callback argument in NodeJs "module.exports"? Pin
MaxySpark4-Jul-16 10:03
MaxySpark4-Jul-16 10:03 
AnswerRe: What is the work of callback argument in NodeJs "module.exports"? Pin
rah_sin12-Jul-16 0:42
professionalrah_sin12-Jul-16 0:42 
QuestionForming your own panel Pin
Member 126139631-Jul-16 3:06
Member 126139631-Jul-16 3:06 
AnswerRe: Forming your own panel Pin
Richard MacCutchan1-Jul-16 3:48
mveRichard MacCutchan1-Jul-16 3:48 
QuestionError in parentNode.replaceChild while hiding content which is available in web page Pin
srikrishnathanthri1-Jul-16 2:41
srikrishnathanthri1-Jul-16 2:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.