语言

Menu
Sites
Language
dynamically changing wear footer button text

Hello,

I need to change the text on the footer button on Gear3 depending on which section is getting displayed. Here is my code

.
.
<footer class="ui-footer ui-bottom-button" id="pageFooter">
    		<a href="#" class="ui-btn" id="footerButton">Button</a>
</footer>
.
.
.
.
this.statusSectionFooterButton = $("footerButton");
console.log("attempting to change texts");
this.statusSectionFooterButton.textContent="Locked";
.
.

The text in the object in the debugger shows as "Locked" but the button still displays "Button". I also tried .html("Locked") but still nothing. Any ideas why this does not work or how to do it properly?

Thanks,

-Jirka

编辑者为: Jirka Prazak 11 5月, 2017

响应

2 回复
Iqbal Hossain

Use innterHtml to bind the text.

//index.html
<div id="main" class="page">
    <div class="contents" id="btnDiv">
        <a class="btnSpan" id="content-text">Basic</a>
    </div>
</div>

 

//main.js
 var startBtnList = document.querySelector('#btnDiv');
    
startBtnList.addEventListener("click", function() {
    var contentText = document.querySelector('#content-text');
    contentText.innerHTML = (contentText.innerHTML === "Basic") ? "Tizen" : "Basic";
});

 

Jirka Prazak

Thanks,

I ended up using this approach but the main problem was I was missing # in the selector so it did not find anything ;)

-Jirka