I am trying to implement the example from the jquery homepage. I have: http://www.mytroutfishingtips.com/archive/test11.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <link rel="stylesheet" href="../effect.css" type="text/css" /> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> <script type="text/javascript" src="http://static.jquery.com/files/rocker/scripts/custom.js"></script> </head> <body> <div id="jq-learnjQuery" class="jq-clearfix"> <div id="jq-learnNow"> <div class="jq-codeDemo jq-clearfix"> <code>$("p.neat").addClass("ohmy").show("slow");</code> <a href="http://docs.jquery.com/Tutorials" class="jq-runCode">Run Code</a> <p class="neat"><strong>Congratulations!</strong> You just ran a snippet of jQuery code. Wasn't that easy? There's lots of example code throughout the <strong><a href="http://docs.jquery.com/">documentation</a></strong> on this site. Be sure to give all the code a test run to see what happens.</p> </div> </div> </div> </body> </html> Code (markup): How do I amend the code so that "$("p.neat").addClass("ohmy").show("slow");" is not outputted to the pages but the code still works? Many thanks Notting
omit or comment out this line: <code>$("p.neat").addClass("ohmy").show("slow");</code> Code (markup):
ok- i didn't even try to see what the function was doing, just tried to eliminate the document from writing that line of code. you could of course change that line of code to: <span id="inv"> <code>$("p.neat").addClass("ohmy").show("slow");</code></span> Code (markup): which of course means that you need to add this css rule: #inv {display:none;} Code (markup): and then it will never show. if you need that line to be there before the click but not afterwards, change the JQ function to reflect that.