Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

HTML TD Top Right X Click?

Posted on 2014-10-29
8
Medium Priority
?
161 Views
Last Modified: 2014-11-04
It seems the background image is the best way to place a clickable X in the top-right corner of a table td. I cannot have the entire td clickable.
Q. Would use a very small image and position to the right side?

Also need the click event fire a function which will remove the TD and it's one label.
0
Comment
Question by:WorknHardr
  • 4
  • 4
8 Comments
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 40411720
We might be able to help if we could see your code.  It's just guessing otherwise.  A TD is part of a table.  Removing one TD will have an effect on the rest of the table.
0
 

Author Comment

by:WorknHardr
ID: 40411896
Doing this from my iPhone. It's one master table with two side-by-side tables, each having several row items. The red-x click on each td containing the title label will remove its table. This leaves the master table with one less nested table.

<table id="master">
<tr>
<td>
<table>
    <tr><td><label>title1</label></td></tr>
    <tr><td>item1</td></tr>
    <tr><td>item2</td></tr>
 </table>
</td>
<td>
<table>
    <tr><td><label>title2</label></td></tr>
    <tr><td>item1</td></tr>
    <tr><td>item2</td></tr>
</table>
</td>
</tr>
</table>
0
 
LVL 84

Accepted Solution

by:
Dave Baldwin earned 2000 total points
ID: 40412205
Here is a very simple example with text instead of an image.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
 "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- HideTable.html -->
<title>Hide the Table</title>
<script type="text/javascript">
<!--
function hide1() {
	document.getElementById('table1').style.visibility = 'hidden';
	document.getElementById('table1').style.display = 'none';
	}

// -->
</script>
</head>
<body>
<h1>Hide the Table</h1>
<table id="master" width="240px" border="1">
<tr valign="top">
<td width="120px">
<div align="right" onclick="hide1()"><b>Click here</b></div>
<table id="table1">
    <tr><td><label>title1</label></td></tr>
    <tr><td>item1</td></tr>
    <tr><td>item2</td></tr>
 </table>
</td>
<td>
<table id="table2">
    <tr><td><label>title2</label></td></tr>
    <tr><td>item1</td></tr>
    <tr><td>item2</td></tr>
</table>
</td>
</tr>
</table>

</body>
</html>

Open in new window

0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:WorknHardr
ID: 40414999
Nice, I need to use an image...
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 40415064
Just put the image in place of "<b>Click here</b>".
0
 

Author Comment

by:WorknHardr
ID: 40415603
Got it, thx
0
 

Author Closing Comment

by:WorknHardr
ID: 40423274
Got it, thx
0
 
LVL 84

Expert Comment

by:Dave Baldwin
ID: 40423319
You're welcome.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
The first step to building an amazing About page is to figure out what you want the page to say about your company. You then must grab the attention of the reader, boast a bit, tell a story and let others brag about you. With a little bit of thought…
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

885 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question