javascript - updating class using jquery -
in 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 component container div follows:
this.container = $(document.createelement('div')); this.container.addclass('patient-hover-inner'); this.container.appendto(this.form);
i want change class 'li' item id = 'scenario' 'disabled' 'active'. how do this? above won't work without errors
$('ul[id="scenario"] li').addclass("active");
can
$('ul li#scenario').removeclass("disabled").addclass("active");
if li
has disabled class removed. if doesn't nothing happens. in either case 'active' class added.
Comments
Post a Comment