The first one coming up null is a bug.
For the second, change
ui.newHeader.text
to
ui.newHeader.text()
You could also add an id to each header, then access via
ui.newHeader.attr("id")
- Richard
On Sat, Aug 1, 2009 at 9:00 AM, PLane007 <[email protected]>wrote:
>
> 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'];?
> >assets/graphics/colourpicker.png' alt='Colour Picker'
> onclick="showColorPicker(this,document.forms[0].css_bgcolor,'backtest',
> 2)"></td></tr></table>
> </div>
> </div>
> <div>
> <h3><a href="#">Image Background</a></h3>
> <div >
> <input type="image" id="bgchoice3" class="link"
> name="bground" align="right" alt="Image Picker" src="<?=$GLOBALS
> ['links_url'];?>assets/graphics/imagepicker.png" />
> </div>
> </div>
> </div>
> </div><!-- End accordionResizer -->
> </div>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery UI" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-ui?hl=en
-~----------~----~----~----~------~----~------~--~---