Pregunta

I am working on a project using MVC and dropdown lists. When the dropdown list changes, I have some javascript code that needs to execute. I started having trouble debugging it (system locked up everytime) so I created a stripped down, simple example to see where the problem is (sample is below).

When I run this code through IE 11, it works just fine. However, when I run this using the IE 11 developer tools (javascript debugger) and place a breakpoint within my select list change function, the debugger and IE hang. Worse, I cannot close them as my system essentially hangs. The only way out is to log off or shutdown the machine manually. Has anyone run into this issue before? I have had 2 developers where I work try this and it breaks for them as well.

Interestingly, this can be debugged just fine in Google Chrome and Firefox.

<script src="~/Scripts/jquery-2.1.0.js"></script>

<script type="text/javascript">
    $(document).ready(function () {
        $("#mySelect")
            .change(function () {
               var x = $(this).val(); // Breakpoint here
                $("#myTextbox").val(x);
            });

        $("#myTextbox")
            .change(function () {
                var x = $("#myTextbox").val();
                alert(x);
            });
    });
</script>

<select id="mySelect">
    <option value="hello">Hello</option>
    <option value="world">World</option>
</select>

<input type="text" id="myTextbox" />
¿Fue útil?

Solución

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top