In the following html, jquery, bootstrap code,
addMenuBar : function addNavigation (component) {
var html = '<ul class="nav nav-pills nav-justified" role="tablist">';
html += '<li id ="scenario" class="disabled"><a href="#">Scenario</a></li>';
html += '<li id ="resolutions" class="disabled"><a href="#">Resolutions</a></li>';
html += '<li id ="triggers" class="disabled"><a href="#">Triggers</a></li>';
html += '</ul>';
component.append(html);
$('ul[id="scenario"] li').addClass("active");
}
where the component is a container div as follows:
this.container = $(document.createElement('div'));
this.container.addClass('patient-hover-inner');
this.container.appendTo(this.form);
I want to change the class for the 'li' item for id = 'scenario' from 'disabled' to 'active'. how do i do this? The above won't work without any errors
$(document.createElement('div'))You are using jQuery:$("<div>")ULwith a class ofscenariowhereas you want theLI. Secondly[id="scenario"]should just be#scenario, and thirdly when dealing with IDs they should be unique, so you just want$('#scenario')- no tagnames necessary