javascript - Put li attribut on a span -


i beginner in wonderful world of dev , need you. let me explain :

i have menu deploys when pressing on burger , reveals 3 items . on 1 hand when click on item menu closes , on other hand cut item appear in span :)

$('li').click(function() { alert($(this).attr('id'));}) 

thank help. demo jsfiddle

envoy

simple : jsfiddle

added

 $('li').click(function() {    $('h1 + span').text( $(this).attr('id') )    $('#overlay').removeclass('open');    $('#toggle').removeclass('active');  }) 

also removed class open #overlay after click li menu closes, , removed class active button changes x hamburger lines . can exclude these 2 lines if don't need them


Comments