Click here to Skip to main content
15,885,782 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hello people, I want to convert this javascript code to Jquery code, can some one help me plz?

JavaScript
function addRow(tableID) {

    var table = document.getElementById(tableID);

    var rowCount = table.rows.length;
    var row = table.insertRow(rowCount);

    var cell1 = row.insertCell(0);
    var element1 = document.createElement("input");
    element1.type = "checkbox";
    element1.name="chkbox";
    element1.onclick= function () {toggleCheckbox(this)};
    cell1.appendChild(element1);

    var cell2 = row.insertCell(1);
    cell2.innerHTML = document.getElementById("fname").value;

    var cell3 = row.insertCell(2);
    cell3.innerHTML = document.getElementById("lname").value;
}
Posted
Comments
What have you tried?
Member 10279189 4-Dec-14 12:34pm    
I don't know how to write it in Jquery Plugin, I want to convert this java Script code to Jquery code. thank you
I would suggest you to study jQuery first, then try. If we give you the code directly, then what will you understand, nothing, right !!!
Member 10279189 4-Dec-14 13:01pm    
I want to study Jquery, but bow I have to convert it. I have no time to do this now, I have just one hour to provide this part of project as a work
Richard MacCutchan 4-Dec-14 13:08pm    
Then you need to explain to whoever gave you that task that it is not possible.

1 solution

This article may help you: A Whistle-stop Tour of jQuery[^].
 
Share this answer
 
Comments
Member 10279189 4-Dec-14 12:54pm    
ok, I accept it, but anyway, I want to convert this javascript code to Jquery please
Richard MacCutchan 4-Dec-14 13:07pm    
Then you first need to learn jQuery and redesign your code to fit it. No one else is going to do your work for you.
Sergey Alexandrovich Kryukov 4-Dec-14 17:37pm    
No, the answer is not accepted. Isn't it because Richard did not want to do your work? The answer is reasonable; the best you can do is to learn jQuery and get a habit to do your own work. You get quite reasonable help; and jQuery is easy. If you face some particular problem you could clearly explain, we will gladly help you.
—SA
Sergey Alexandrovich Kryukov 4-Dec-14 17:33pm    
5ed.
—SA
My 5 too. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900