On Thu, Oct 30, 2008 at 11:53 AM, Martin S. <[EMAIL PROTECTED]>
wrote:
>
> On Oct 30, 3:01 pm, "Ted Gifford" <[EMAIL PROTECTED]> wrote:
> > And then your jquery call would be something like
> >
> > jQuery('.foo').each(function(){
> > var settings = jQuery('.fooinput', this).val();
> > // find one of many implementations online
> > var dict = parsevalues(settings);
> > // new GMaps2(this, dict)
> >
> > });
> Mmmm, nice idea,
> but this would move most of the setting parsing from python to
> javascript, which I would like to avoid.
> All this just to avoid the problems with an ID is a little to much in
> my opinion.
If that is too much parsing in javascript (it's really not that much [15
lines?], you're using a large javascript API in GMaps), then you could
instead store all the values separately in inputs, and use the
jQuery('.dataDiv').serializeArray() method:
<div class="container">
<form class="inputs" action="#">
<input type="hidden" name="center" value="79.4,67.3"/>
<input type="hidden" name="zoom" value="5"/>
...
</form>
<div class="gmap"></div>
</div>
and then
jQuery('.container').each(function(){
var dict = jQuery('form.inputs', this).serializeArray();
.....
});
> Do you know if jQuery code can access somehow the surrounding tag if
> it in a 'script' tag (inside an 'div' tag)?
> <div class='googlemap'>
> <script type="text/javascript">
> // something like:
> jQuery(....).SurroundingScriptTag().ParentTag()
> </script>
> </div>
I don't think so. And besides, who wants ugly scripts in their markup when
there's a better way?
Ted
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac
Users" 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/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---