facebook

[SOLVED]status of toggle – how do you read it in custom.js??

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

    WiZaxx
    Participant

    Hello,

    I spend almost half a day to try to find out how to read the status of a toggle object into a variable, but failed miserably. Am I missing something?

    What do I need to look for?
    getElementById(‘m1-home-toggle’).??_WHAT_??;

    In case I haven’t missed the documentation, the lack of it is just as phenomenal as the software itself 🙂

    Cheers

    #318833 Reply

    support-michael
    Keymaster

    Here is a snippet of JQuery code for accessing toggle control’s value. The underlying implementation uses an HTML <input type=”checkbox”> See the snippet below and the screenshot.

    
    In the following snippets #m1-Untitled2-toggle1 is the id of the <div> that wraps the internal checkbox. 
    
    $('#m1-Untitled2-toggle1 input').attr('checked')
    or
    $('#m1-Untitled2-toggle1 input').is(':checked')
    
    Attachments:
    You must be logged in to view attached files.
    #318834 Reply

    WiZaxx
    Participant

    wow, that’s beyond my coding skills (for now :))

    How would I turn it into a variable that I can then use in my logic?

    THANK YOU FOR THE PROMPT REPLY!

    #318835 Reply

    WiZaxx
    Participant

    Sorry I was to lazy to read more on jQuery…
    Got it

    var xxx = $(‘#m1-Untitled2-toggle1 input’).attr(‘checked’)

    actually returns true or false as value of the variable.

    Kool.
    Thanks

Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: [SOLVED]status of toggle – how do you read it in custom.js??

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