javascript - adding a new section on webpage using only css and js -
i trying click on image on webpage , open new section on page created in css , javascript/jquery. thought using .addclass() not entirely sure how go it. can give me example of being done?
an example clicking on element id foo
, adding div id bar
after element:
$("#foo").click(function(){ $(this).after('<div id="bar">some content</div>'); });
of course, there multiple methods in jquery insert content somewhere in dom tree, see:
https://api.jquery.com/category/manipulation/dom-insertion-outside/
https://api.jquery.com/category/manipulation/dom-insertion-inside/
Comments
Post a Comment