adding a checkbox in a tab label in yui
-
08-03-2021 - |
Question
I want to have a checkbox in my tab label , but when i set it in label attribute the check box is added but when clicked it doesnt get checked , here's the code i used:
var tabView = new YAHOO.widget.TabView(); tabView.addTab( new YAHOO.widget.Tab({ label: "label1<input id='check' type='checkbox' name='check' value=' '/>", active: true })); tabView.addTab( new YAHOO.widget.Tab({ label: "label2<input id='check2' type='checkbox' name='check2' value=' '/>", active: false }));
any hint to fix this ?
Thanks.
Solution
The tab labels are rendered inside link tags, so e.preventDefault()
is used to stop the navigation to the specified URL. See http://yuilibrary.com/yui/docs/api/files/tabview_js_tab.js.html#l17 and http://yuilibrary.com/yui/docs/api/files/tabview_js_tab.js.html#l97
You should be able to get around this by altering myTabView.CONTENT_TEMPLATE
or overriding the myTabView._onActivate
method before calling myTabView.render()
.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow