MVC input button onclick does not work after changing it in jQuery
<p>I've a dropdownlist and button in a page as below:</p>

<pre><code>@Html.DropDownList("MovieType")

&lt;input id="btnBk" type="button" value="Back" onclick="location.href = '/Test/Index/'"  /&gt;
</code></pre>

<p>The dropdownlist is populated in the controller:</p>

<pre><code>public ActionResult DDL()
{
    List&lt;SelectListItem&gt; items = new List&lt;SelectListItem&gt;();

    items.Add(new SelectListItem { Text = "Action", Value = "0" });

    items.Add(new SelectListItem { Text = "Drama", Value = "1" });

    items.Add(new SelectListItem { Text = "Comedy", Value = "2", Selected = true });

    items.Add(new SelectListItem { Text = "Science Fiction", Value = "3" });

    ViewBag.MovieType = items;

    return View();
}
</code></pre>

<p>When a dropdownlist item is selected, I try to change the button onclick from the original /Test/Index/ to /Test/Index1 :</p>

<pre><code>$(document).ready(function () {            
    $('#MovieType').change(function () {
        var href = $('#btnBk').attr("onclick");
        alert(href);
        $('#btnBk').attr('onclick', "location.href='/Test/Index1/'");
        href = $('#btnBk').attr("onclick");
        alert(href);
    })
});
</code></pre>

<p>Alert messages indicate that the onclick value is updated. But when click on the Back button after changing, it has no response instead of redirecting to /Test/Index1.</p>

<p>Is something missing?</p>

<p>Thanks in advance,
Ben</p>
