Kelb56 Kelb56 - 1 year ago 111
Javascript Question

Jquery in MVC

Description: I am trying to fadeIn() my container using jquery, but it doesn't work. Im kinda new to it, only fresh out of codeacademy jquery course.

Problem: the method i wrote in myScript.js file doesn't seem to work. The syntax looks to be ok compared to other examples. I got my js file linked to the html file like this:

<script type="text/javascript" src="/Content/js/myScript.js"></script>

This is my index.cxhtml file where i created a container for some navigation:

<div class="container" id="fade">
//some other buttons, divs, etc

This is my custom js file that I included:

$(document).ready(function () {

Answer Source

You should hide the div by default if you want to fade it in, otherwise it is already showing and fading in won't do anything. If that's the case, your html should look like this:

<div class="container" id="fade" style="display: none;">
    //some other buttons, divs, etc
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download