Hello

I wonder if somebody knows how to solve the next:

I want to send a value from the template to a script and it seems it works 
but I get an error: Uncaught TypeError: Cannot read property 'value' of null

Below it is my code:

*Template:*

<input type="hidden" id="idobra" name="variable" value="{{ obra.id }}">

{{ obra.id }} is an object sended from views.py

*Javascript:*

var idobra = document.getElementById("idobra").value;
console.log(idobra);

And I don't know what I'm doing wrong. I would like to know if there is 
another way to send objects directly from django to javascript or if I'm 
doing well like that, but solving the problem.

Thank you very much!

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/81b65371-ce65-40e2-94ff-a876a24f6a86%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to