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
Solved

HTML TD Top Right X Click?

Posted on 2014-10-29
8
149 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 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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

 

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

809 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