We have created a table with an edit and delete icon button, where you can select table rows, and click on the edit button it passes the information to the bootstrap modal window.
Onclick of the Edit button, the bootstrap Modal popup is displayed with corresponding row values inside it and on Onclick of submit button inside the modal popup, we will the edited values from the popup to be displayed back in that table row without reloading our web page.
I have a table that is displaying information from tables and I have added a feature that after every row there is an edit button so that when the user clicked you can update the information for that row.I have created a popup using bootstrap that will show up when you click on the edit icon in the table row.
<!DOCTYPE html>
<html>
<head>
<title>JavaScript edit table row using popup</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" />
</head>
<body>
<div class="container">
<h1>JavaScript edit table row using popup</h1>
<br />
<fieldset>
<legend>
Customer List
</legend>
<table class="table">
<thead>
<tr>
<th>Id</th>
<th>First Name</th>
<th>Last Name</th>
<th>Email</th>
<th>Action</th>
</tr>
</thead>
<tbody id="tblbody">
<tr id="1">
<td class="td-data">1</td>
<td class="td-data">George</td>
<td class="td-data">Bluth</td>
<td class="td-data">george.bluth@reqres.in</td>
<td class="td-data">
<button class="btn btn-info btn-xs" onclick="showEditRow()">Edit</button>
<button class="btn btn-danger btn-xs" onclick="deleteRow()">Delete</button>
</td>
</tr>
<tr id="2">
<td class="td-data">2</td>
<td class="td-data">Janet</td>
<td class="td-data">Weaver</td>
<td class="td-data">janet.weaver@reqres.in</td>
<td class="td-data">
<button class="btn btn-info btn-xs btn-editcustomer" onclick="showEditRow()">Edit</button>
<button class="btn btn-danger btn-xs btn-deleteCustomer" onclick="deleteRow()">Delete</button>
</td>
</tr>
<tr id="3">
<td class="td-data">3</td>
<td class="td-data">Emma</td>
<td class="td-data">Wong</td>
<td class="td-data">emma.wong@reqres.in</td>
<td class="td-data">
<button class="btn btn-info btn-xs btn-editcustomer" onclick="showEditRow()">Edit</button>
<button class="btn btn-danger btn-xs btn-deleteCustomer" onclick="deleteRow()">Delete</button>
</td>
</tr>
<tr id="4">
<td class="td-data">4</td>
<td class="td-data">Eve</td>
<td class="td-data">Holt</td>
<td class="td-data">eve.holt@reqres.in</td>
<td class="td-data">
<button class="btn btn-info btn-xs btn-editcustomer" onclick="showEditRow()">Edit</button>
<button class="btn btn-danger btn-xs btn-deleteCustomer" onclick="deleteRow()">Delete</button>
</td>
</tr>
<tr id="5">
<td class="td-data">5</td>
<td class="td-data">Charles</td>
<td class="td-data">Morris</td>
<td class="td-data">charles.morris@reqres.in</td>
<td class="td-data">
<button class="btn btn-info btn-xs btn-editcustomer" onclick="showEditRow()">Edit</button>
<button class="btn btn-danger btn-xs btn-deleteCustomer" onclick="deleteRow()">Delete</button>
</td>
</tr>
<tr id="6">
<td class="td-data">6</td>
<td class="td-data">Tracey</td>
<td class="td-data">Ramos</td>
<td class="td-data">tracey.ramos@reqres.in</td>
<td class="td-data">
<button class="btn btn-info btn-xs btn-editcustomer" onclick="showEditRow()">Edit</button>
<button class="btn btn-danger btn-xs btn-deleteCustomer" onclick="deleteRow()">Delete</button>
</td>
</tr>
</tbody>
</table>
</fieldset>
</div>
<!-- Modal -->
<div id="myModal" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Update Detail</h4>
</div>
<div class="modal-body">
<div class="form-group">
<label for="email">UserId:</label>
<input type="text" readonly class="form-control" id="txtupdate_ID">
</div>
<div class="form-group">
<label for="email">First name:</label>
<input type="text" class="form-control" id="txtupdate_firstName">
</div>
<div class="form-group">
<label for="email">Last name:</label>
<input type="text" class="form-control" id="txtupdate_lastName">
</div>
<div class="form-group">
<label for="email">Email address:</label>
<input type="email" class="form-control" id="txtupdate_email">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-info" onclick="updateData()">Save</button>
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
</body>
</html>
<script type="text/javascript">
function showEditRow()
{
var rowdataId = event.target.parentNode.parentNode.id;
//this gives id of tr whose button was clicked
/*returns array of all elements with "td-data"" class within the row with given id*/
var data = document.getElementById(rowdataId).querySelectorAll(".td-data");
var ID = data[0].innerHTML;
var firstname = data[1].innerHTML;
var lastname = data[2].innerHTML;
var email = data[3].innerHTML;
document.getElementById("txtupdate_ID").value = ID;
document.getElementById("txtupdate_firstName").value = firstname;
document.getElementById("txtupdate_lastName").value = lastname;
document.getElementById("txtupdate_email").value = email;
$("#myModal").modal("show");
}
function deleteRow() {
var rowdataId = event.target.parentNode.parentNode.id;
document.getElementById(rowdataId).remove();
}
function updateData() {
var rowdataId = document.getElementById("txtupdate_ID").value;
var datatr = document.getElementById(rowdataId).querySelectorAll(".td-data");
var Name = document.getElementById("txtupdate_firstName").value;
var lastName = document.getElementById("txtupdate_lastName").value;
var email = document.getElementById("txtupdate_email").value;
datatr[0].innerHTML = rowdataId;
datatr[1].innerHTML = Name;
datatr[2].innerHTML = lastName;
datatr[3].innerHTML = email;
var actionbtn = "<button class='btn btn-info btn-xs' onclick='showEditRow()'>Edit</button>" +
"<button class='btn btn-danger btn-xs' onclick='deleteRow()'>Delete</button>"
datatr[4].innerHTML = actionbtn;
$("#myModal").modal("hide");
}
</script>
HTML utilizes “HTML Tags” to make web archives. Every HTML tag characterizes the text that separates it somehow or another. This is called Markup. “<i>” is a HTML label that emphasizes the in the middle between.
Allow us to grasp this with a model.
We take a word, ‘appsloveworld’ which is composed basically. Which is straightforwardly noticeable to us like the ordinary text “appsloveworld”. Presently we markup it through HTML. Also, in the markup we make it sideways. When appsloveworld is composed like this <i>appsloveworld</i> between these two images, then this word will seem like this stressed “appsloveworld”. That is, it has been stamped italic.
This entire interaction is hit increasing itself. And all the web records on the web are organized along these lines.
This might appear to be a straightforward and ludicrous inquiry. Yet, assuming you ponder it, its existence is uncovered.
You have previously discovered that HTML is utilized to make web archives. Yet, it isn’t restricted to simply making web records.
Since HTML is the premise of the web. Without it the making of the web can’t be envisioned.
Aside from making HTML archive, it is additionally utilized a great deal here.
However, this way isn’t all that simple, on the grounds that a website specialist should have inventive abilities and specialized capacities. With the goal that he can make an incredible site. So presently the inquiry emerges that how to begin learning web planning. For this, there is a requirement for the right rules like which language and devices would it be a good idea for you to figure out how to use as a website specialist? What comes in this? Which course is expected for this.
Aside from this, there are numerous things whose information you ought to have. Here, data has been given pretty much that multitude of rules, which will help you in learning web planning.
Visual computerization – Although visual communication is a different subject, however it goes under web planning. It is the art of making visual substance to convey messages. By executing visual pecking order and page format procedures, website specialists use typography and outlines to meet the particular necessities of the client, while likewise zeroing in on the rationale of showing components in intelligent plan to upgrade the client experience. is.
Making Page Structure – You can likewise call the page design of a site as its establishment. The significant job of a website specialist is to further develop the webpage structure. Under web planning, the whole design of the site is ready, this work is finished utilizing HTML.
The post How to leave just points without lines in ChartJS appeared first on Software Development | Programming Tutorials.
Read More Articles
- [Simple Way]-Cascading DropDownList in Asp.Net Mvc Using Jquery Ajax
- jQuery Ajax GET Example with Parameters
- How to Pass Parameters in AJAX POST?| JQuery Ajax Post Json Example
- [Simple Way]-How to get data from database using JQuery Ajax in asp net MVC
- How to add, edit and delete rows of an HTML table with Jquery?
- Registration form with image upload in MVC using jquery Ajax
- How to make an Inline editable table in MVC using jquery?
- Insert Update Delete Using Jquery Ajax and Modal Popup in Mvc
- [Solved]-How to Upload pdf file using jquery MVC?
- Dynamically creating graphs with jQuery
- On prettyphoto lightbox how do you move the X or close button to upper right?
- Custom JS function is not defined issue
- ruby on rails - how to read json file using ajax?
- how to check context menu event is triggered from mouse or keyboard in jquery?
- Problem synchronizing DOM manipulation with style changes in carousel
- Function to change text is not working jQuery
- Javascript Regular Expression that match accent and none-accented version of a string
- How to pass a text from a div to another div
- Slide (toggle) divs to one side
- Javascript disable button after click, but form doesn't submit
- Programmatically trigger mac screenshot using Javascript
- how to get my captions placed correctly?
- attach event to object/array
- Get URL Hash use in Jquery to change class of ID
- Getting scrollTop() to perform only once
- insert a dynamic value inside
- jQuery Mobile : How to change Radio button active state color
- Getting value of select element using jquery
- How can I get four icons on the same line in the table header with bootstrap table?
- Improve performance of searching JSON object with jQuery
- Mixed Content Issue in IE while injecting form inside a dynamic iframe
- jQuery $("#Div").height() returns undefined
- Looping over table rows and moving contents from one cell to another with jQuery
- Use CSS/Javascript received through AJAX
- Jquery add/remove class on checkboxes
- Opposite method to toLocaleDateString
- jQuery: Click on div -> select option of a dropdown
- Creating fixed position text as the page scrolls down then stop a certain position
- Overwrite javascript file object
- How can I sum the price of the item that I selected from my dropdown that retrieved in the database
- Logic behind hiding elements
- jQuery slide jumps around on some divs
- JQuery - Is() function optimalization
- JQuery Equal Height Rows
- Owl carousel Slider-Is it possible to control via hover paginator instead of click paginator?
- ZombieJS - How do I call JavaScript functions or check JavaScript values?
- jquery Autocomplete doesn't display autcomplete list
- HTML - Show/Hide Buttons on Bootstrap Panel collapse/expand
- Get the text within children nodes using jquery
- Timeout time counting does not detect input field
- Jquery/JS/CSS Hover code
- Plugin - comma decimals
- jquery function with Ajax failing in Chrome and Opera
- Crossfade background images in a body
- Why wrap code into 'document ready'
- Code below the textarea getting inside the textarea as its value?
- Mobile javascript framework with Twitter Bootstrap
- jQuery datepicker: manual firing of onChangeMonthYear()
- How to create a Range Object from a point (X and Y Coordinates)?
- Sorting in table not working when having rows with and without colspan
- How do i get attribute values from html inputs?
- How to read the data from javascript in jtemplate
- Adding multiple DropDownLists with a button click
- How read response from a post request in jquery?
- Deselecting radio buttons while keeping the View Model in synch
- Using variables when referencing DOM jQuery DOM objects
- Not able to assign data from cross domain json to a variable in Ajax
- jquery - Copy one row of table to another
- FullCalendar: How can i display an icon on each day of the month using the function DayRender?
- Prevent Moving to Next Tab If Input Field Is Empty
- jQuery drop down menu position while scrolling
- Get id of SharePoint formfield for jQuery
- jQuery drag and drop then open alert specific for each list item
- Fluid width of input element
- jQuery change() event - Not with bind(), live(), keyup+keydown+keypress, nothing
- Why GridView Filters does not work when in modal bootstrap?
- JQuery AJAX HandleErrorAtribute PartialView
- Toggle the div with a button and hide the div when click outside of that div
- Jquery tokenInput - Cannot read property of undefined problem
- Touch event not firing AJAX using jQuery Plugin -- Hammer.js
- Javascript not working on page refresh
- JQuery Post Form in ASP.NET MVC 3.0 FormCollection
- Page Layout and implementation
- How to execute code after ALL AJAX loaded elements and code have fully loaded?
- How to use AWS Polly PHP SDK via AJAX to stream in HTML5 audio player
- prettyPhoto not working on document ready
- How to align glyphicon with first line of accordion title
- jQuery accordion is always expanded / refresh required to work
- Jquery .each() on dynamic data issue
- Why float :right not working in css3?
- Google Maps in jQuery Accordion works in jsFiddle, but maps do not load on my server until window MANUALLY resized
- JQM Remove an element upon form select value
- Getting number of rows having specific .data() value
- How do I update DataTables columns (and other properties) dynamically?
- Is It possible to inject a scope variable from a controller into a service function Angular?
- Laravel jQuery - Pagination and product filters, pagination URLs
- Cloning an element and adding it to Dom multiple times
- Applying superscipt/subscript tag using javascript/jquery
- Sum values in nested knockout observableArray
- jscrollPane disappear when continuously Ajax GET
- jQuery plugin to allow name/value properties in "class" attribute?
- Showing a loading message whilst JavaScript code is running
- jquery .position() returns .offset() in chrome
- Coffeescript HTML5 audio pause all other audio elements
- Select all contenteditable divs
- show/hide options in drop down using jquery
- Checkbox not working when repeating using Angular ng-repeat directive
- ipad disable select options w/o jquery
- Ruby on Rails AJAX form to External API
- Change background-image using jQuery addClass
- Alert does not appear for links inserted by JavaScript
- JQuery Login, hit enter to login
- ajax perl chat submit button send parameters and reload only inside frame
- Enclosing external jQuery file in $(document).ready()
- animated div... can't get it to stop pushing all divs (Magento)
- Closest previous element with certain ID (with prev())?
- Loop through jquery data() object to get keys and values
- Adding custom JavaScript/jQuery effects to MVC 3 form validation
- how to make Jquery menu sticky
- How can i assign php variables for different div classes in bootstrap?
- getJSON only getting first element of returned array
- Why is jQuery.extend defined as a jQuery function property and jQuery.fn.extend defined as a jQuery prototype object property
- Bind click event for all children of dynamic div
- Any Changes to an Ajax script produces an Uncaught TypeError
- Signature Pad not working in IE7
- Reading the content of a SPAN in click event
- simple jQuery appears fine except in IE7
- Jquery Find first h1 on a page and append more html to its html
- Replacing text with a checkbox using ReplaceWith
- Call JavaScript function while the asp:LinkButton been clicked
- Why do I get Uncaught SyntaxError: Unexpected token ILLEGAL
- Ajax page load with <a> tag
- How to pass extra parameter on AJAX call of jQuery DataTable
- How to change the button icon with javascript and open a new text area in MJQ
- jQuery: Getting strange errors on setInterval calls… is my syntax wrong?
- Bayaux protocol implementation for Jquery
- jquery prettyphoto problem
- Scrollmagic: Prevent scrolling of page while in scene
- jQuery Selecting Elements That Have Class A or B or C
- One way of prepending html with jquery works but why the other way doesn't?
- can't add callback function to jquery getJSON
- Get top href and innerHTML from within an iframe
- AJAX login form reloading the page
- In Jquery context menu how can i identify the right clicked element is href or not?
- Words highlight on mouse over
- why does "HTML file select" changes the order of selected files and sort them alphabetically?
- JQuery: Perform a post before a link is followed
- Fancybox popup once time for session
- How to slide out a box to full box-content with jQuery?
- Select elements with attribute value in a list of values
- Family tree with mother and father (or parent couple)
- Load target ajax php file on initial page load
- jQuery addClass() with Bootstrap
- Fixed marker on google maps
- HTML form file input does not associates correctly with parameters passed to server [Rails]
- I get a syntax error after JQuery upgrade from 1.51 to 2
- Remove empty <p>, but allow only one per group
- How to stop centered list from ofsetting to the right
- How to get time of FlipClock?
- Draggable Div with a textarea in it. Drag problem