-3

I have a code like this:

<div id="advertisement-template" style="display:none;">
</div>

and there is an element like this inside

<script type="text/javascript">
....................
....................
....................
        });
    </script>

When I use <script type="... element by itself it works but when it is inside <div id="advertisement-template" style="display:none;"> it doesn't show up. I cannot change anything above or inside <div id="advertisement-template" style="display:none;">, I can only put something between <div id="advertisement-template" style="display:none;"> and </div> to make the element show up.

I have checked this page and this one but haven't found a solution.

I don't know much about coding yet but I need a solution for this problem. Please help.

3
  • 2
    Could you provide a code example of what works and what does not work? That will make it easier for others to help you. Commented Nov 22, 2018 at 6:42
  • I would not recommend this but if it is inevitable you could use this in style tag or in stylesheet #advertisement-template[style]{ display:block !important; } to override the inline-style.
    – vssadineni
    Commented Nov 22, 2018 at 6:54
  • I'm not sure I understand the problem. You can put a <script> inside the div? Like this? But it doesn't work in your setup? Then either I don't understand the question, or you need to explain more about your setup.
    – Mr Lister
    Commented Nov 22, 2018 at 7:23

1 Answer 1

-1

pls try below jquery

<script>
    $(document).ready(function() {
        $("#advertisement-template").removeAttr("style");
    });
</script>

Not the answer you're looking for? Browse other questions tagged or ask your own question.