How to call existing JavaScript function from Java method using CodeName One?

Viewed 129

I have an HTML file with a simple JavaScript function, and I want to call this existing JavaScript function from my Java method using CodeName One library.

<!DOCTYPE html>

<html>
<head>
    <title>who cares?</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script>
        function setName(name)
        {
            document.getElementById("nameLabel").innerHTML = name;
        }
    </script>
</head>
<body>
    <div>
        peace be upon you, you are welcomed :  <span id="nameLabel"
                                                     style="color: blue;"></span>
    </div>
</body>
</html>

So my question is how to call setName(name) function from Java code using CodeName One.

Although I found related questions and answers such as one this but I didn't find what I want!

1 Answers
Related