Hi.

In my MVC project I have a button that has to trigger a script.
As it happens the page doesn't listen to the event.

I put the script in my view where the form is.

this works

<script >
              alert("it worked");
</script>

this doesn't work

<script >
         $(document).ready(function () {
            $("#btnSubmit").click(function () {
                alert("it worked");
</script>

this doesn't work

<script >
             $(window).load(function () {
                $("#btnSubmit").click(function () {
                    alert("it worked");
    </script>

Can't find any solution on the net

Thanks in advance

SOLVED

just had to put an id="btnSubmit" on the button (i had it as name="btnSubmit")

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.