I have implemented a table with three columns: "Action", "Question Subquestion/Text", and "Sort order". Additionally, I have incorporated a feature that allows for drag and drop functionality on the rows.
Below is my code snippet:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible"
content="IE=edge">
<meta name="viewport"
content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<style>
table th,
table td {
width: 50px;
padding: 5px;
border: 0.5px solid black;
}
.GFG {
color: green;
}
.OK {
font-size: 18px;
}
</style>
<body>
<h2 class="GFG">Overall Experience</h2>
<p class="OK">Drag and Drop Table Row</p>
<table id="GFG">
<tr>
<td>Action</td>
<th>Question Subquestion/Text</th>
<th>Sort Order</th>
</tr>
<tr>
<td>Delete</td>
<td>Edit</td>
<td>View</td>
</tr>
<tr>
<td>Symbol1</td>
<td>Question1</td>
<td>1</td>
</tr>
<tr>
<td>Symbol2</td>
<td>Question2</td>
<td>2</td>
</tr>
<tr>
<td>Symbol3</td>
<td>Question3</td>
<td>3</td>
</tr>
<tr>
<td>Symbol4</td>
<td>Question4</td>
<td>4</td>
</tr>
</table>
<script type="text/javascript" src=
"https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js">
</script>
<link rel="stylesheet"
href=
"https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.24/themes/smoothness/jquery-ui.css" />
<script type="text/javascript"
src=
"https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.24/jquery-ui.min.js">
</script>
<script>
$(function () {
$("#GFG").sortable({
items: 'tr:not(tr:first-child)',
dropOnEmpty: false,
start: function (G, ui) {
ui.item.addClass("select");
},
stop: function (G, ui) {
ui.item.removeClass("select");
$(this).find("tr").each(function (GFG) {
if (GFG > 0) {
$(this).find("td").eq(2).html(GFG);
}
});
}
});
});
</script>
</body>
</html>
Currently, I am looking to enhance the functionality by replacing the numbers in the "Action" column with symbols for Delete, Edit, and View. The delete symbol will allow users to remove the entire row, while the edit and view symbols will direct them to another page for editing and viewing purposes. As a newcomer to this, any assistance in implementing these changes would be greatly appreciated.