Magento2: How to add script .js to blockHow to add addition script to existing validation classCan't add jquery scriptMagento 2 add script before closing body tagMagento2 - Backend layout seems brokenCMS Read More scriptMagento 2 custom Admin controller redirect to DashboardTable create script not working Magento2how to call script from block argument?Magento 2.2.5: How to validate shipping addressInvalid Return Type in Ajax Call

UK Tourist Visa- Enquiry

Asserting that Atheism and Theism are both faith based positions

When should a starting writer get his own webpage?

How old is Nick Fury?

Air travel with refrigerated insulin

Help with identifying unique aircraft over NE Pennsylvania

Friend wants my recommendation but I don't want to give it to him

Why doesn't the fusion process of the sun speed up?

How to understand 「僕は誰より彼女が好きなんだ。」

Gauss brackets with double vertical lines

Turning a hard to access nut?

"Marked down as someone wanting to sell shares." What does that mean?

How are passwords stolen from companies if they only store hashes?

Hot air balloons as primitive bombers

How to test the sharpness of a knife?

Is VPN a layer 3 concept?

What are the consequences of changing the number of hours in a day?

Homology of the fiber

How can a new country break out from a developed country without war?

is this saw blade faulty?

Imaginary part of expression too difficult to calculate

Does convergence of polynomials imply that of its coefficients?

Print last inputted byte

The English Debate



Magento2: How to add script .js to block


How to add addition script to existing validation classCan't add jquery scriptMagento 2 add script before closing body tagMagento2 - Backend layout seems brokenCMS Read More scriptMagento 2 custom Admin controller redirect to DashboardTable create script not working Magento2how to call script from block argument?Magento 2.2.5: How to validate shipping addressInvalid Return Type in Ajax Call













2















I want add script with reviews to custom_block in magento 2.



<span id="__ceneo-reviews-5404f405-e31c-4e74-9b51-0ebeee8bcd2d"></span>
<br/>
<small>
<a href="https://www.ceneo.pl/26306-0a" rel="nofollow" target="_blank">&raquo; przeczytaj wszystkie opinie</a>
</small>

<script>
(function (d,t)
var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
g.src('https:'==document.location.protocol?'https://':'http://')+'ssl.ceneo.pl/shops/rw.js?accountGuid=5404f405-e31c-4e74-9b51-0ebeee8bcd2d';
s.async=true;
s.parentNode.insertBefore(g, s);
(document,'script'));
</script>


after save, I see only this content in html.
enter image description here Looks .js do not work here. Any solution?










share|improve this question




























    2















    I want add script with reviews to custom_block in magento 2.



    <span id="__ceneo-reviews-5404f405-e31c-4e74-9b51-0ebeee8bcd2d"></span>
    <br/>
    <small>
    <a href="https://www.ceneo.pl/26306-0a" rel="nofollow" target="_blank">&raquo; przeczytaj wszystkie opinie</a>
    </small>

    <script>
    (function (d,t)
    var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
    g.src('https:'==document.location.protocol?'https://':'http://')+'ssl.ceneo.pl/shops/rw.js?accountGuid=5404f405-e31c-4e74-9b51-0ebeee8bcd2d';
    s.async=true;
    s.parentNode.insertBefore(g, s);
    (document,'script'));
    </script>


    after save, I see only this content in html.
    enter image description here Looks .js do not work here. Any solution?










    share|improve this question


























      2












      2








      2








      I want add script with reviews to custom_block in magento 2.



      <span id="__ceneo-reviews-5404f405-e31c-4e74-9b51-0ebeee8bcd2d"></span>
      <br/>
      <small>
      <a href="https://www.ceneo.pl/26306-0a" rel="nofollow" target="_blank">&raquo; przeczytaj wszystkie opinie</a>
      </small>

      <script>
      (function (d,t)
      var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
      g.src('https:'==document.location.protocol?'https://':'http://')+'ssl.ceneo.pl/shops/rw.js?accountGuid=5404f405-e31c-4e74-9b51-0ebeee8bcd2d';
      s.async=true;
      s.parentNode.insertBefore(g, s);
      (document,'script'));
      </script>


      after save, I see only this content in html.
      enter image description here Looks .js do not work here. Any solution?










      share|improve this question
















      I want add script with reviews to custom_block in magento 2.



      <span id="__ceneo-reviews-5404f405-e31c-4e74-9b51-0ebeee8bcd2d"></span>
      <br/>
      <small>
      <a href="https://www.ceneo.pl/26306-0a" rel="nofollow" target="_blank">&raquo; przeczytaj wszystkie opinie</a>
      </small>

      <script>
      (function (d,t)
      var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
      g.src('https:'==document.location.protocol?'https://':'http://')+'ssl.ceneo.pl/shops/rw.js?accountGuid=5404f405-e31c-4e74-9b51-0ebeee8bcd2d';
      s.async=true;
      s.parentNode.insertBefore(g, s);
      (document,'script'));
      </script>


      after save, I see only this content in html.
      enter image description here Looks .js do not work here. Any solution?







      magento2 javascript






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 14 hours ago









      Gee Emm

      1299




      1299










      asked 15 hours ago









      SylvesterSylvester

      735216




      735216




















          1 Answer
          1






          active

          oldest

          votes


















          1














          I hope, you may call that block in your custom phtml file right If so you can keep html element in cms block and keep JS snippet in your custom phtml file.



          Something like below way,



          <script type="text/javascript" xml="space">
          (function (d,t)var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.src=('https:'==document.location.protocol?'https://':'http://')+'ssl.ceneo.pl/shops/rw.js?accountGuid=5404f405-e31c-4e74-9b51-0ebeee8bcd2d';s.async=true;s.parentNode.insertBefore(g, s);(document,'script'));
          </script>





          share|improve this answer






















            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "479"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f266387%2fmagento2-how-to-add-script-js-to-block%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            1














            I hope, you may call that block in your custom phtml file right If so you can keep html element in cms block and keep JS snippet in your custom phtml file.



            Something like below way,



            <script type="text/javascript" xml="space">
            (function (d,t)var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.src=('https:'==document.location.protocol?'https://':'http://')+'ssl.ceneo.pl/shops/rw.js?accountGuid=5404f405-e31c-4e74-9b51-0ebeee8bcd2d';s.async=true;s.parentNode.insertBefore(g, s);(document,'script'));
            </script>





            share|improve this answer



























              1














              I hope, you may call that block in your custom phtml file right If so you can keep html element in cms block and keep JS snippet in your custom phtml file.



              Something like below way,



              <script type="text/javascript" xml="space">
              (function (d,t)var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.src=('https:'==document.location.protocol?'https://':'http://')+'ssl.ceneo.pl/shops/rw.js?accountGuid=5404f405-e31c-4e74-9b51-0ebeee8bcd2d';s.async=true;s.parentNode.insertBefore(g, s);(document,'script'));
              </script>





              share|improve this answer

























                1












                1








                1







                I hope, you may call that block in your custom phtml file right If so you can keep html element in cms block and keep JS snippet in your custom phtml file.



                Something like below way,



                <script type="text/javascript" xml="space">
                (function (d,t)var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.src=('https:'==document.location.protocol?'https://':'http://')+'ssl.ceneo.pl/shops/rw.js?accountGuid=5404f405-e31c-4e74-9b51-0ebeee8bcd2d';s.async=true;s.parentNode.insertBefore(g, s);(document,'script'));
                </script>





                share|improve this answer













                I hope, you may call that block in your custom phtml file right If so you can keep html element in cms block and keep JS snippet in your custom phtml file.



                Something like below way,



                <script type="text/javascript" xml="space">
                (function (d,t)var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.src=('https:'==document.location.protocol?'https://':'http://')+'ssl.ceneo.pl/shops/rw.js?accountGuid=5404f405-e31c-4e74-9b51-0ebeee8bcd2d';s.async=true;s.parentNode.insertBefore(g, s);(document,'script'));
                </script>






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 14 hours ago









                ThamoThamo

                312




                312



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Magento Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f266387%2fmagento2-how-to-add-script-js-to-block%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Sum ergo cogito? 1 nng

                    419 nièngy_Soadمي 19bal1.5o_g

                    Queiggey Chernihivv 9NnOo i Zw X QqKk LpB