Solved

HTML TD Top Right X Click?

Posted on 2014-10-29
8
151 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 83

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 83

Accepted Solution

by:
Dave Baldwin earned 500 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
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!

 

Author Comment

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

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 83

Expert Comment

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

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
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).

752 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