0

I've added some javascript code below to show some photos using a slide show jquery plugin.

//parent template
{% block javascripts %}
    <script src="{{ asset('http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js') }}" type="text/javascript"></script>
    <script src="{{ asset('bundles/canalonesfrontend/js/slides.min.jquery.js') }}" type="text/javascript"></script>
{% endblock %}

//child template
{% block javascripts %}
    {{ parent() }}
    $(function(){
        $("#slides").slides();
    });
{% endblock %}

The problem: the code is shown in the web page directly:

Some content
$(function(){ $("#slides").slides(); }); 

1 Answer 1

4

you have to wrap with <script></script> tag around your code

//child template
{% block javascripts %}
    {{ parent() }}
    <script type="text/javascript">
    $(function(){
        $("#slides").slides();
    });
    </script>
{% endblock %}

I hope you understood the problem!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.