I tried that before, but it only seems to work when it is used on
the .html file.

onchange="changeArea('{{ list_areas.BC|safe|escapejs}}')

I need it to be onchange="changeArea('{{ list_areas|safe|escapejs}}')
so the function can use list_areas (My javascript and html are on
separate files).

On .js file,

If I use:
function changeArea(selectedAreas)
{
        alert({{list_areas.BC}});
}

with or without the |escapejs would cause the entire javascript not to
work.

If I use:
function changeArea(selectedAreas)
{
        alert(selectedAreas.BC);
}

or

function changeArea(selectedAreas)
{
        alert(selectedAreas["BC"]);
}
would be undefined.

However, if it is:

function changeArea(selectedAreas)
{
        alert(selectedAreas[0]);
}

I will get "{"

Thanks again.  (If I missed the answer in the docs, sorry :) )
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to