Page is a not externally linkable
- Code, Content, and Presentation
-- JavaScript and AJAX
---- work with multiple DIV IDs


daveVk - 2:45 am on Feb 7, 2012 (gmt 0)


Did not notice dual use of boxcap, either change to say, boxcapDiv and boxcapSpan OR use span.boxcap as in the css.

$("span.boxcap").click(function(){

'this' refers to the object to which a function is attached, in this case the particular span.boxcap clicked. To make code more readable give it a name.

function(){
var boxcapSpan = this;
$(boxcapSpan).closest('.box').find('.boxcont').slideToggle('fast');
if (boxcapSpan.innerHTML == '[hide]')
{boxcapSpan.innerHTML = '[show]'}
else
{boxcapSpan.innerHTML = '[hide]'}
}


Thread source:: http://www.webmasterworld.com/javascript/4414488.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com