i'm trying hide divs on click using .click()
event , .hide()
method.
the thing each 1 has different id
'chosen' user, can't write code each case.
example:
html
<body> <div id="box"> <div id="div1"></div> <div id="div2"></div> <div id="div3"></div> </div> </body>
jquery
$(document).ready(function() { $(---selector divs 1,2,3----).click(function) { $(----specificdiviclicked----).hide(); }); });
basicaly, i'm trying find way delete div click on.
try select divs inside box
div :
$(document).ready(function() { $('#box div').click(function(){ $(this).hide(); }); });
$(document).ready(function() { $('#box div').click(function(){ $(this).hide(); }); });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id="box"> <div id="div1">div1</div> <div id="div2">div2</div> <div id="div3">div3</div> </div>
Comments
Post a Comment