adding complete.ly script in Worpdress

I have a WordPress 3.9.1 and added complete.ly script to my WP-page so there is an autocomplete field but it does not show the dropdown list and even not available to edit. The code list below works in plain html but does not work in WordPress. Where I am wrong and how to do it right?

<div id="filwrap" style='border-bottom:1px solid #333;margin:20px auto;width:500px;'>
</div>
<script src='http://lorenzoongithub.github.io/completely/complete.ly.1.0.1.min.js'></script>
<script>
    var c = completely(document.getElementById('filwrap'),
        {fontFamily:'sans-serif', fontSize:'26px', promptInnerHTML : '>' });
    c.input;
    c.hideDropDown();
    var availablePDF = [
                      "1", "2", "3", "4", "5", "6", "7", "8", "9",
                      "RAL7-520.48-BLK.23(54.2.3.141.0.48)",
                      "RAL7-520.48-BLK.23(54.2.3.141.0.49)"
                       ];
    c.options = availablePDF;
    c.hideDropDown();
    c.onChange = function(fil){ c.startFrom = fil.indexOf(',')+1; c.repaint(); };
    setTimeout(function() { c.input.focus(); c.repaint(); }, 0);
 </script>

Related posts

Leave a Reply

1 comment

  1. I have understood the problem: WordPress inserts wrong p tags that is why inline java script is not working. The solution is to disable wpautop or use plugin “Toggle wpautop” or similar to do this work for you.