0

I working on little page where user have to select 4 thing, once the last option value is selected then I want to execute external script like to load overly player:

<script scr="video.js" async="true" callback="myFunction()"></script>

Tried to use $.getScript but it's not working as I wanted. This is part of the code where I tried to add:

$("select").change(function(){
    $(this).find("option:selected").each(function(){
        var optionValue = $(this).attr("value");
        if(optionValue){
            $(".box").not("." + optionValue).hide();
            $("." + optionValue).show();

        } else{
            $(".box").hide();
        }
    });
}).change();

Thanks for help and understanding, Bart

1
  • where is the select options? Commented Oct 20, 2017 at 14:10

1 Answer 1

0

Topic can be closed, below you can check how I made it working

    $("select").change(function(){
    $(this).find("option:selected").each(function(){
        var optionValue = $(this).attr("value");
        if(optionValue){
            $(".box").not("." + optionValue).hide();
            $("." + optionValue).show(function(){
                var includes = $('[data-include]');
                jQuery.each(includes, function(){
                  var file = 'views/' + $(this).data('include') + '.html';
                  $(this).load(file);
                });
              });
        } else{
            $(".box").hide();
        }
    });
}).change();
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.