ajax - MVC2 JQuery Syntax not working -


i trying following :

<script src="scripts/microsoftajax.js" type="text/javascript"></script> <script src="scripts/microsoftmvcajax.js" type="text/javascript"></script> <script src="scripts/jquery-1.4.1.min-vsdoc.js" type="text/javascript"></script>  <%=html.dropdownlist("ddlpostage", new selectlist(model.postageoptions ienumerable, "id", "text", model.selectedpostageid)) %>   <script language="javascript">      $('#ddlpostage').change(function() {          alert('okay go');      });  </script> 

but getting runtime error @ jquery systax. "microsoft jscript runtime error: object expected".

as far concerned path-to-jquery okay because form validation using <% html.enableclientvalidation(); %> worked fine in 1 of previous pages , jquery file sits beside other js files default vs2008.

what doing/what going wrong in here? in advance.


thanks ans. have tried both ways. unfortunately did not work. codes ..

inside main content place holder :

<script src="scripts/microsoftajax.js" type="text/javascript"></script> <script src="scripts/microsoftmvcajax.js" type="text/javascript"></script> <script src="scripts/jquery-1.4.1.min-vsdoc.js" type="text/javascript"></script> <script src="scripts/jquery-1.4.1.min.js" type="text/javascript"></script>  <script language="javascript">      $(document).ready(function() {          $('#ddlpostage').change(function() {              alert('ok go');          });      }); </script>  

just out of curiousity : 1 who's facing issue ??

thanks

first, you're missing reference jquery itself. reference have vsdoc in helper visual studio provide intellisense. add script block reference jquery proper:

<script src="scripts/jquery-1.4.1.min.js" type="text/javascript"></script> 

second, should wire event handlers in document.ready event. code work without this, might act in ways aren't expecting.

 $(document).ready(function() {      $('#ddlpostage').change(function() {          alert('okay go');      });  }); 

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -