Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • dev-thandabantu 41 posts 321 karma points
    Jan 06, 2023 @ 08:07
    dev-thandabantu
    0

    Using the jQuery select2 plugin on an Umbraco 10 form

    I have an Umbraco 10 form that works as intended until I add the following script:

    <script>
       $(function (){ 
          $('#@Model.Id').select2();
       });
    </script>
    

    After adding the script, the second text input field that is supposed to show depending on the selection option from the dropdown options on the first input field stops showing.

    Here is what happens when you select an option from the dropdown options before adding the script: Before

    Here is what happens when you select an option from the dropdown after adding the script: After

    What's confusing more is that I have an Umbraco 8 project where I have a similar form using the select2 plugin and everything is working fine. Could the reason this is not working in the U10 be a result of the change from ASP.NET to ASP.NET Core?

  • Huw Reddick 1737 posts 6098 karma points MVP c-trib
    Jan 06, 2023 @ 10:52
    Huw Reddick
    0

    Could the reason this is not working in the U10 be a result of the change from ASP.NET to ASP.NET Core?

    I would say that is unlikely since you are using javascript which has nothing whatsoever to do with .Net.

    Are you getting any errors/warning in your browser debug console?

  • dev-thandabantu 41 posts 321 karma points
    Jan 09, 2023 @ 07:34
    dev-thandabantu
    0

    There are no errors logged in the console.

Please Sign in or register to post replies

Write your reply to:

Draft