Tabbed Content / Posts /

Regarding disable and enable tabs

-1

i have 8 tabs in a form .I want to enable one tab and disabled all tabs on first time the page load.it is possible in java script.

Ashish  7 years ago   viewed: 6067    

2 Answers

0

not supported this line theLIs[i].children[0].style.pointerEvents = "none"; in IE11.

ashish   7 years ago
-1

Add the following script to the bottom of the page, just before the closing tag </body> of the body:

<script> var theUL = document.getElementsByClassName("tabs")[0]; var theLIs = theUL.children; for (var i = 0; i < theLIs.length; i ) { if (i == 1) { //make the 2nd tab active theLIs[i].className = "selected"; } else { theLIs[i].className = "disabled"; //you need to further style the .disabled in CSS //disable links within the LI theLIs[i].children[0].style.pointerEvents = "none"; //Not supported by old IEs theLIs[i].children[0].onClick = function (e) { e.preventDefault();}; } } </script> <script src="tabcontent.js" type="text/javascript"></script>

Note I have also moved the tabcontent.js script link from the page <head>...</head> section to the bottom of the page so that the tabcontent.js will run after the customized setting we just added.

Milo   7 years ago

   

Your name*
Password
(Optional. Used to modify this post afterwords)
+ =  

Ask your Own Question

  • If your question is related to the topic of this post, you can post your question to this page by clicking the "Post a reply" button at left;

  • When you want to start a new page for your question: