jquery - Javascript not executed? -
i not understand why 'alert' javascript not executed on page...
when clicking on first step menu, second 1 displayed expected point no more javascript executed , not alert displayed.
this simple page using jquery remove/add class.
here code:
<!doctype html> <html lang="en"> <head> <meta charset="utf-8" /> <title>hello world jquery</title> <link href="style.css" rel="stylesheet" type="text/css"> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script type="text/javascript"> function displaystep2() { $("#searchstep1").addclass("displaynone"); $("#searchstep2").removeclass("displaynone"); } function displaystep3() { alert('hello, world!');step } </script> </head> <body> <div id="searchcontainer"> <div id="searchstep1"> <h2>step1:</h2> <ul id="searchlist1"> <li id="search11" onclick="displaystep2()"><span>1.1</span></li> <li id="search12" onclick="displaystep2"><span>1.2</span></li> </ul> </div> <div id="searchstep2" class="displaynone"> <h2>step2:</h2> <ul id="searchlist2"> <li id="search21" onclick="displaystep3"><span>2.1</span></li> <li id="search22" onclick="displaystep3"><span>2.2</span></li> <li id="search23" onclick="displaystep3"><span>2.3</span></li> </ul> </div> <div id="searchstep3" class="displaynone"> <h2>step3:</h2> <ul id="searchlist3"> <li id="search31" onclick=""><span>3.1</span></li> <li id="search32" onclick=""><span>3.2</span></li> </ul> </div> </div> </body> </html>
and css:
.displaynone{ display: none }
is somone me not become crazy...?!
you have write displaystep3();
instead of displaystep3
. latter no function call.
Comments
Post a Comment