Joel Stransky
2010-02-16 19:46:53 UTC
Still very new to django so excuse the newbish questions.
This might be obvious but I need a smart solution.
I have a template that runs a jquery function at document ready which
defines a few other functions. I only need a couple of these functions in
the template I'm extending, the other I need tacked on to specific children
of the template.
So I have:
<script type="text/javascript">
$(document).ready(function(){
//function 1
$("#my_id").click(function() { /* do stuff */ });
//function 2
$("a.someClass").click(function() { /* do stuff */ });
//function 3
$("#my_other_id").hover(function() { /* do stuff */ });
});
</script>
But what I need is to able to insert function 3 (or others) in a child of my
base template
Ideally it would look like this:
{% block jquery %}
{{ block.super }}
//function 3
$("#my_other_id").hover(function() { /* do stuff */ });
{% endblock jquery %}
How do I achieve something to that effect?
This might be obvious but I need a smart solution.
I have a template that runs a jquery function at document ready which
defines a few other functions. I only need a couple of these functions in
the template I'm extending, the other I need tacked on to specific children
of the template.
So I have:
<script type="text/javascript">
$(document).ready(function(){
//function 1
$("#my_id").click(function() { /* do stuff */ });
//function 2
$("a.someClass").click(function() { /* do stuff */ });
//function 3
$("#my_other_id").hover(function() { /* do stuff */ });
});
</script>
But what I need is to able to insert function 3 (or others) in a child of my
base template
Ideally it would look like this:
{% block jquery %}
{{ block.super }}
//function 3
$("#my_other_id").hover(function() { /* do stuff */ });
{% endblock jquery %}
How do I achieve something to that effect?
--
--Joel Stransky
stranskydesign.com
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com.
To unsubscribe from this group, send email to django-users+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
--Joel Stransky
stranskydesign.com
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-***@googlegroups.com.
To unsubscribe from this group, send email to django-users+***@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.