div' inside 'table'
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>test</title>
</head>
<body>
<table>
<tr>
<td>
<div>content</div>
</td>
</tr>
</table>
</body>
</html>
This document was successfully checked as XHTML 1.0 Transitional!
Access contents of div inside table cell
Use
$(check).closest(".task-modal-row").find(".task_description").text();
To access the content of the closest .task_description
How to set 100% height of div inside table cell
Demo - codepen
Here's another relevant SO answer
It appears you need to add a height to the <table>
tag.
<table style="border-collapse: collapse; height:100%">
How can i apply css for div inside table?
You can do something like this:
table.new td div{
color:red;
}
It will change the css of Div inside a td tag.
XPath how to select specific div inside of table row
I was able to solve it by using:
//td/div[text()='test1']/ancestor::tr/td/div[@class='custom' and text()='Failed']
How to correctly select a div inside a table cell
I made some changes in your code. Removed deleteRow
binded on table and add event only on div
element, then find parent row element and removed it from table
Does this help you?
function createNewTableElement() {
var inputField = document.getElementById("new-item");
if (inputField.value == "") {
return;
}
var row = document.createElement("tr");
var cell = document.createElement("td");
var div = document.createElement("div");
div.onclick = deleteRow;
var cellText = document.createTextNode(inputField.value);
cell.appendChild(div);
cell.appendChild(cellText);
row.appendChild(cell);
obj = document.getElementById("main-table");
obj.appendChild(row);
}
function deleteRow(e) {
document.getElementById('main-table').removeChild(e.target.parentElement.parentElement);
}
#main-table div {
height: 10px;
width: 10px;
border: 1px solid;
display: inline-block;
margin-right: 10px;
}
<button class="btn" onclick="createNewTableElement()">Add</button>
<input id="new-item" type="text" value="item">
<table id="main-table">
Related Topics
CSS Selector for Empty or Whitespace
How to Create a Slanted Background with CSS
Convert Attributed String, To, "Simple" Tagged HTML
CSS - Hide Options from Select Menu on iPhone & Safari
How to Horizontally Scroll the Contents in Mobile/Tablet View in HTML/Css
Page Break Is Not Working with the Tbody Issue
Target Safari CSS, But Not Chrome
Aligning Elements Left and Center with Flexbox
Drawing Multiple Edges Between Two Nodes with D3
When Does Whitespace Matter in HTML
Grails: Displaying Created Image in Gsp
Displaying Elements Other Than Fullscreen Element (Html5 Fullscreen API)