facebook

how to refer a label within a page in multiPage: CLOSED

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #351304 Reply

    joaba
    Member

    The following is not working for me

    $(‘#m1-myapp-multiPage1-page1-text1’).text(“Hello World”);

    Even though all names of assets seems to be correct.
    This is trying to change the text within a label ‘text1’ that is in page ‘page1’ in a multiPage called ‘multiPage1’

    Is there something missing?

    many thanks

    #351308 Reply

    support-michael
    Keymaster

    Try loading the project in the simulator. Then open the inspector (f12) and navigate into the DOM. Verify that you have the correct element id. Then try js code snippets in the console. Be sure to set context to your startup html file as shown below. See attachment debug1.jpg

    Attachments:
    You must be logged in to view attached files.
    #351313 Reply

    Code_A
    Member

    If it is a textfield, try changing your code to use .val() instead of .text().

    $('#m1-myapp-multiPage1-page1-text1').val("Hello World");

    I have always referenced them directly, the catch here of course would be to have unique names for all the textfields on your pages.

    $('#m1-myapp-text1').val("Hello World");

    EDIT: Since your subjects states that you are using a label and not a textfield, then try assigning the value directly like this:

    $('#m1-myapp-text1').text("Hello World");
    #351321 Reply

    joaba
    Member

    Thanks a lot Code-A!!

    The solution

    $(‘#m1-myapp-text1’).text(“Hello World”);

    is what is working best!

    Thanks also to support-team, this helps to understand better how is the code structured.

    Best

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: how to refer a label within a page in multiPage: CLOSED

You must be logged in to post in the forum log in