html - Adequate CSS selector 1 nested element up -


using css selectors, to, on click of link, put box shadow around div 1 element up.

    <!doctype html>     <html>         <body>             <div class="container">                 <div id="selected_div">                     <a><p id="click"></p></a>                 </div>             </div>         </body>     </html> 

i not know selectors use. please enlighten me.

considering want action based upon click, it's better use javascript anyway. css has no parent selector , cannot detect click. here jquery solution:

$("document").ready(function() {   $("#selected_div a").click(function() {     $(this).parent().css("box-shadow", "2px 2px 3px #fff");   } } 

remember include jquery library.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -