Geeks With Blogs
ken spencer

Well, this one was fun.

So my mvc app was having trouble with javascript files. Seems like if I had more than one file linked in, that only the 1st was picked up.
The tags looked like so:

<script  src="<%=Url.Content("~/Scripts/CheckDate.js")%>" type="text/javascript"/>

After much scratching my hair out and trying different things, I figured it out. The problem is the />.

You have to end the script tag like so with </script> and not the shortcut syntax:

<script  src="<%=Url.Content("~/Scripts/CheckDate.js")%>" type="text/javascript"></script>


Changing this allows it work fine. Totally wild.

Posted on Wednesday, April 27, 2011 2:48 PM | Back to top

Comments on this post: mvc: JavaScript tags

# re: mvc: JavaScript tags
Requesting Gravatar...
I have had my share of fight with this issue sometime back. "Totally wild" - I agree.
Left by Arun Mahendrakar on Apr 27, 2011 8:37 PM

Your comment:
 (will show your gravatar)

Copyright © xamlnotes | Powered by: