Accordion Usage
Accordion Usage
Being quite new to JQuery, I find that whilst it is powerful, the
syntax takes a bit of getting your head round.
I am trying to identify when the user clicks on a section to record
the choice in a local HTML variable for the form. The responses I get
from the following code are:
[first alert] null
and then
[second alert] function (F) {
if (typeof F !== "object" && F != null) {
return this.empty().append((this[0] && this
[0].ownerDocument || document).createTextNode(F));
}
var E = "";
o.each(F || this, function () {o.each(this.childNodes,
function () {if (this.nodeType != 8) {E += this.nodeType != 1 ?
this.nodeValue : o.fn.text([this]);}});});
return E;
}
So how do you identify which section has been clicked?
JQuery script:
$(function(){
// Accordion
$("#accordion").accordion({
header: "h3",
fillSpace: true,
change: function(event, ui) {
var active = $('#accordion').accordion('option', 'active');
alert(active);
alert(ui.newHeader.text);
}
});
});
HTML extract:
<!-- Accordion -->
<div class="ui-widget-content ui-corner-all mygr_add"
style="border: 2px; padding: 3px; font-size: 12px; height: 200px">
<div class="ui-widget-header ui-corner-all dragme" >
<span class="box-header">Background Type</span>
</div>
<div id="accordionResizer" style="padding:5px; width:250px;
height:150px;" >
<div id="accordion" class="nodrag">
<div>
<h3><a href="#">Solid Colour</a></h3>
<div>
<table cellpadding=5><tr><td><input type="text"
value="{val css_bgcolor}" size="8" maxlength="7" align="top"
id="css_bgcolor" name="css_bgcolor" /></td>
<td><img class='link' src='<?=$GLOBALS['home_url'];?