facebook

How to reference an item: CLOSED

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

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

    dsebastian
    Member

    Hello,

    This is a simple question but I have a javascript function and I’m trying to access an textfield element on a page (Screen1)
    In the alert window I get “undefined”

    function GetData()
    {
    var p = $(‘#m1-Screen1.txtID’).val();
    alert(p);
    }

    thanks

    #329649

    dabbelju
    Member

    Hi ,

    try

    alert($(‘#m1-Screen1.txtID’).text());

    But I doubt, that the name of the field is correct. You can find it in the html file which is generated when you start the app in design center. Should be something like #m1-Screen1-text1.

    If you want to set a vale do
    alert($(‘#m1-Screen1.txtID’).text(“Test”));

    Hope this helps
    best

    dabbelju

    #329650

    Hi dsebastian,

    To learn more how to interact with widgets please see the next doc: Widget Implementation & JavaScript Customization

    #329653

    dsebastian
    Member

    Thanks for the help… Here is what is in the .html file

    <input id=”m1-Screen1-txtID” class=”m1-textfield m1-textfield-border m1-font-5″ value=””
    type=”text” name=”txtID”/>

    #329654

    dsebastian
    Member

    Sorry my mistake syntax error…

    var p = $(‘#m1-Screen1.txtID’).val();

    should be

    var p = $(‘#m1-Screen1-txtID’).val();

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: How to reference an item: CLOSED

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