I have the following HTML:
<div class="custom-select">
<div class="custom-select-placeholder">
<span id="placeholder-pages">Show all posts</span>
</div>
<ul class="custom-select-list animate-show no-padding no-margin" >
<li ng-click="selectItem($event)">Show all posts</li>
<li ng-click="selectItem($event)">Events</li>
<li ng-click="selectItem($event)">Files</li>
<li ng-click="selectItem($event)">Pictures</li>
<li ng-click="selectItem($event)">Thoughts</li>
</ul>
</div>
When I click on a 'li' item, I need to fetch its innerHTML and set the innerHTML of the span having its id as 'placeholder-pages' to the value fetched.
For this I wrote the following function in my controller:
$scope.selectItem = function(evt) {
var selected = evt.target.innerHTML; //working
var placeholder = document.getElementById('placeholder-pages'); //working
placeholder.innerHTML = selected; //not working
}
In the function I am able to get the innerHTML of the 'li' selected and also the 'placeholder-pages' div. But I cannot set the div's innerHTML. I am not getting any error. Nothing happens.