-5

I have a table which is 9 x 9 with each cell having a different option.

Is it possible to do this:

When one of the cells text is clicked, everything relating to that is shown under that cell.

For example the cell title is advertising and when its clicked it shows links to different advertisers.

Is there a better way of doing this ?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Stefan Lazic
  • 41
  • 1
  • 11

2 Answers2

1

Have a look at this http://fiddle.jshell.net/QsWkB/ Hope that helps.

Mina
  • 1,508
  • 1
  • 10
  • 11
  • 2
    It is always better to post the code in the answer. SO doesn't entertain link only answers because they will be of no use if the link becomes inactive for whatever reason. – Harry Sep 13 '13 at 10:28
  • That it ! but how would i make it so if one is open and another is clicked on it will be open. – Stefan Lazic Sep 13 '13 at 10:31
  • 1
    @Harry Understood! Will do that from now on. – Mina Sep 13 '13 at 10:32
  • @StefanLazic I don't understand your question. – Mina Sep 13 '13 at 10:34
  • When a cell is clicked the content is shown . But when another is clicked the original remains open. How would I stop this from happening – Stefan Lazic Sep 13 '13 at 10:35
  • By hiding all the .cell-content DIV's before showing the one you clicked on `$(document).on('click', 'td', function(){ $('div.cell-content').hide(); $(this).find('div.cell-content').toggle(); });` http://fiddle.jshell.net/QsWkB/1/ – Mina Sep 13 '13 at 10:40
  • @Kyra Iv just coppied the code into a blank page and none of the drop downs work – Stefan Lazic Sep 13 '13 at 10:47
0

You can put a div containing related information and keep its display as none. On click of that particular test, just use toggle() for that corresponding div.

Ganesh Pandhere
  • 1,612
  • 8
  • 11