c# - Trying to implement jQuery tabs in .NET Web Application -


I'm trying to apply however, JavaScript is not working (all the content is showing at all times Tab also is not 'switching'). All JS files are hosted locally.

Content placeholder in my head:

  & lt; Link rel = "stylesheet" type = "text / css" href = "jquery-ui.css" & gt; & Lt; Script src = "jquery.min.js" & gt; & Lt; / Script & gt; & Lt; Script src = "jquery-ui.min.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; // $ $ is not working (document) .ready (function () {$ ("# tab"). Tab ();}); & Lt; / Script & gt;  

In my main body content placeholder:

  & lt; Div id = "tabs" & gt; & Lt; Ul & gt; & Lt; Li & gt; & Lt; A href = "# tab-1" & gt; A & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "# Tab2" & gt; DOS & lt; / A & gt; & Lt; / Li & gt; & Lt; Li & gt; & Lt; A href = "# tab3" & gt; Derry & lt; / A & gt; & Lt; / Li & gt; & Lt; / Ul & gt; & Lt; Div id = "tabs-1" & gt; & Lt; P & gt; Blah blah blah & Lt; / P & gt; & Lt; / Div & gt; & Lt; Div id = "tabs-2" & gt; & Lt; P & gt; Blah something else & Lt; / P & gt; & Lt; / Div & gt; & Lt; Div id = "tab-3" & gt; & Lt; P & gt; Blah again & Lt; / P & gt; & Lt; / Div & gt; & Lt; / Div & gt;  

By searching till now and wherever Google has taken me, this is what I found and tried (with the results of each list):

  • Wrap the jQuery code into $ .ready (function () {// code here}); instead of a simple function ( $ (function () {$ ("#tabs") .tabs ();}); . This does not work in any way Uses

  • , $ ("# & lt;% = tabs.ClientID%>") Do the tab (); so that the .NET html element can get the ID. In addition to working not , it also causes an error: The tab is not present in the current context

  • javascript in the same content placeholder as #tabs div tag still does not work.

  • Add runat = "server" to tag #tabs div . Still does not work.

  • Delete the designer file, then right click on the Select Aspx file and select "Convert to Web App" This does not work because it is already is a web application and there is no designer file.

  • <

    < Strong> Update: Please let me know your Browser Console Law Was asked to look at and found in the following:

    • One of the JS files is giving a HTTP / 1.1 401 unauthorized error I noticed that blocking it Was given and I blocked it from the file system, but it still does not work.
    • I think the problem may occur in the way of jquery script.

      Try to check the loading of resources in the browser console, or you can try to include jquery from the jquery server ...

        & lt; Link rel = "stylesheet" href = "http://code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css" & gt; & Lt; Script src = "http://code.jquery.com/jquery-1.9.1.js" & gt; & Lt; / Script & gt; & Lt; Script src = "http://code.jquery.com/ui/1.10.4/jquery-ui.js" & gt; & Lt; / Script & gt;  

Comments