javascript - Changing div using links -



javascript - Changing div using links -

i got code uses links alter divs when paste these codes dreamweaver , open html file on firefox or google chrome don't work. work flawlessly on fiddle though. help appreciated.

here jsfiddle.

firefox

google chrome

css / html / jquery / demo class="snippet-code-js lang-js prettyprint-override">$(document).ready( function () { // optional code hide divs $("div").hide(); $("#one").show(); // show chosen div, , hide others $("a").click(function (e) { e.preventdefault(); $("#" + $(this).attr("class")).show().siblings('div').hide(); }); }); class="snippet-code-css lang-css prettyprint-override">.divstyle { height:300px; width:300px; border:1px solid #000; } .liststyle li { display:inline-block; } class="snippet-code-html lang-html prettyprint-override"><script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> click button create visible: <br /> <br /> <ul class="liststyle"> <li><a id="one_link" href="#" class="one">one</a> </li> <li><a id="two_link" href="#" class="two">two</a> </li> <li><a id="three_link" href="#" class="three">three</a> </li> <li><a id="four_link" href="#" class="four">four</a> </li> </ul> <br /> <br /> <div class="divstyle" id="one">one</div> <div class="divstyle" id="two">two</div> <div class="divstyle" id="three">three</div> <div class="divstyle" id="four">four</div> <br/> <br/>

try in dreamweaver:

<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>works in ff , chrome</title> <style> .divstyle { height:300px; width:300px; border:1px solid #000; } .liststyle li { display:inline-block; } </style> </head> <body> click button create visible:<br /><br /> <ul class="liststyle"> <li><a id="one_link" href="#" class="one">one</a></li> <li><a id="two_link" href="#" class="two">two</a></li> <li><a id="three_link" href="#" class="three">three</a></li> <li><a id="four_link" href="#" class="four">four</a></li> </ul> <br /><br /> <div class="divstyle" id="one">one</div> <div class="divstyle" id="two">two</div> <div class="divstyle" id="three">three</div> <div class="divstyle" id="four">four</div> <br/><br/> <script src="https://code.jquery.com/jquery-1.11.1.min.js"></script> <script> $(document).ready(function() { // optional code hide divs $("div").hide(); $("#one").show(); // show chosen div, , hide others $("a").click(function (e) { e.preventdefault(); $("#" + $(this).attr("class")).show().siblings('div').hide(); }); }); </script> </body> </html>

javascript jquery html css

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -