Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

add edit delete from table using jquery

function Edit(){
	var par = $(this).parent().parent(); //tr
	var tdName = par.children("td:nth-child(1)");
	var tdPhone = par.children("td:nth-child(2)");
	var tdEmail = par.children("td:nth-child(3)");
	var tdButtons = par.children("td:nth-child(4)");

	tdName.html("<input type='text' id='txtName' value='"+tdName.html()+"'/>");
	tdPhone.html("<input type='text' id='txtPhone' value='"+tdPhone.html()+"'/>");
	tdEmail.html("<input type='text' id='txtEmail' value='"+tdEmail.html()+"'/>");
	tdButtons.html("<img src='images/disk.png' class='btnSave'/>");

	$(".btnSave").bind("click", Save);
	$(".btnEdit").bind("click", Edit);
	$(".btnDelete").bind("click", Delete);
};
Comment

add edit delete from table using jquery

$(function(){
	//Add, Save, Edit and Delete functions code
	$(".btnEdit").bind("click", Edit);
	$(".btnDelete").bind("click", Delete);
	$("#btnAdd").bind("click", Add);
});
Comment

add edit delete from table using jquery

function Add(){
	$("#tblData tbody").append(
		"<tr>"+
		"<td><input type='text'/></td>"+
		"<td><input type='text'/></td>"+
		"<td><input type='text'/></td>"+
		"<td><img src='images/disk.png' class='btnSave'><img src='images/delete.png' class='btnDelete'/></td>"+
		"</tr>");
	
		$(".btnSave").bind("click", Save);		
		$(".btnDelete").bind("click", Delete);
}; 
Comment

add edit delete from table using jquery

function Delete(){
	var par = $(this).parent().parent(); //tr
	par.remove();
}; 
Comment

PREVIOUS NEXT
Code Example
Javascript :: how to access viewmodel in jquery 
Javascript :: jquery post docs.google.com/forms/ CORS 
Javascript :: latvia 
Javascript :: react hooks simple projects 
Javascript :: slack icon emoji for alertmanager 
Javascript :: change ul index value with innertext 
Javascript :: regex changing before last dot value 
Javascript :: youtube movie trailer angular 
Javascript :: js date remove am and pm 
Javascript :: jquerybuilder input date 
Javascript :: how to query in windows js 
Javascript :: jquery delete buton 
Javascript :: how do i activate my mangekyou sharingan 
Javascript :: mdn golang 
Javascript :: javascript object property + multilevel + optional chaining 
Javascript :: how to filter data from mongodb date in reactjs 
Javascript :: xjavascript 
Javascript :: gravity forms vote up or down 
Javascript :: cchartpie react 
Javascript :: open close children modal react 
Javascript :: specify the own log file name using the property 
Javascript :: Noblox Shout Command 
Javascript :: Gif Animation on Image jquery 
Javascript :: switch variable scope js 
Javascript :: Detect external link Click javascript 
Javascript :: jqgrid set filter programmatically 
Javascript :: monday.com mutation dropdown list 
Javascript :: 4.3.2. Evaluating Variables¶ 
Javascript :: how to share variables between routes node 
Javascript :: 8.1.4. Array Length or .length 
ADD CONTENT
Topic
Content
Source link
Name
5+8 =