facebook

Really newbie question

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

    MrBean
    Member

    I am in the beginning of the learning curve here.

    I have created a simple page with a text field with id text1 and with a push button that runs a javascript onclick.
    What is the syntax in the java script for changing the text of the text field?

    I have tried with $(‘#form1-text1’).text(‘hello world’) but nothing happens.

    Thanks,

    #325249 Reply

    MrBean
    Member

    Thank you!
    It is possible to figure out the id:s from within the editor or do I need to check the html-code?

    I found the id in the html file so the simple javascript is for updating a text is

    $(‘#m1-WeekNumber-text1’).text(‘hello world’)

    <!DOCTYPE HTML>
    <html>
    <head>
    <title>WeekNumber</title>
    <meta name=”generator” content=”MobiOne Studio – Design Center, http://genuitec.com/mobile“/>
    <meta name=”viewport” content=
    “width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0″/>
    <meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″/>
    <meta name=”apple-mobile-web-app-capable” content=”yes”/>
    <meta name=”format-detection” content=”telephone=no”/>
    <link rel=”stylesheet” href=”WeekNumber.css”/>
    <link rel=”stylesheet” href=”res/spinningwheel.css”/>
    <script type=”text/javascript” src=”res/jquery-1.7.1.min.js”></script>
    <script type=”text/javascript” src=”res/preloadCssImages.js”></script>
    <script type=”text/javascript” src=”res/iscroll.js”></script>
    <script type=”text/javascript” src=”WeekNumber.js”></script>
    <script type=”text/javascript” src=”res/phoneui.js”></script>
    <script type=”text/javascript” src=”res/spinningwheel.js”></script>
    <script type=”text/javascript” src=”WeekNumber_custom.js”></script>
    </head>
    <body>
    <div class=”m1-top-root”>
    <!– Loading spinner –>
    <div class=”m1-loading”>
    <div>
    <canvas class=”m1-loading-spinner” width=”25″ height=”25″></canvas>
    <span class=”m1-loading-text”></span>
    </div>
    </div>
    <!– Prompt to be shown for adding page on homescreen –>
    <canvas class=”m1-homescreen-prompt” width=”250″ height=”120″></canvas>
    <!– ***** WeekNumber ***** –>
    <div id=”m1-WeekNumber” class=”m1-root”>
    <div id=”m1-WeekNumber-panel1″ class=”m1-iscroll-wrapper”>
    <div id=”m1-WeekNumber-panel1-scroller” class=”m1-iscroll-scroller” data-bounce=”true”>
    <div id=”m1-WeekNumber-text1″ class=”m1-text”>Text</div>
    <div id=”m1-WeekNumber-push1″ class=”m1-clickable m1-push-button m1-button” name=”push1″
    data-action-click-id=”action0″>Button</div>
    </div>
    </div>
    </div>
    </div>
    </body>
    </html>

    #325255 Reply

    support-michael
    Keymaster

    @MrBean

    >It is possible to figure out the id:s from within the editor or do I need to check the html-code?

    For now check the html code; at least that is my approach. The id mangling algorithm is not too hard to follow but I’m impatient and just open the code and move on. What is cool is an upcoming version for Mobi where there will be no more id mangling and the javascript action editor will be a full up editor with validation and code assist. I can’t wait…

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Really newbie question

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