jQuery $(document).ready and ASP.NET MVC Partial

前端 未结 2 2102
南旧
南旧 2021-01-05 08:57

I have quite a few partials in my application, and some of them need to do some jQuery goodness at $(document).ready time.

The problem is, if I put the $(document).r

相关标签:
2条回答
  • 2021-01-05 09:03

    well, just plain old never mind!

    http://www.learningjquery.com/2006/09/multiple-document-ready

    0 讨论(0)
  • 2021-01-05 09:12

    is there anything wrong with doing something like this:

    <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<Myapp...SearchResultsViewModel>" %>
    
    <script type="text/javascript">
        $(document).ready(function () {
            alert('partial is ready.');
        });
    </script>
    
    <h1>This is my <%: Model.name %> partial view</h1>
    
    0 讨论(0)
提交回复
热议问题