facebook

Whats wrong in this javascript

💡
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
  • #337425 Reply

    sadimishal
    Member

    hi
    I wrote the following javascript for a button onclick. When the button is clicked, The two commands:
    $(‘#m1-hh-text1’).text(‘hello worlds’))
    $(‘#m1-hh-push5’).css(‘visibility’, ‘hidden’);
    are implemented, as if the word if is not there.
    What’s wrong here.

    if ( $(‘#m1-hh-text1’).text(‘hello worlds’))
    {
    $(‘#m1-hh-push5’).css(‘visibility’, ‘hidden’);
    }

    #337431

    Unknown Author
    Participant

    Using an assignment rather than a comparison in your if statement…?

    #337435

    sadimishal
    Member

    You are right.
    Could you please give me the correct synax for this if statement?

    #337448

    Brandon
    Member
    
    if ( $('#m1-hh-text1').val() == 'hello worlds')
    {
    $('#m1-hh-push5').css('visibility', 'hidden');
    }
    
    #337528

    sadimishal
    Member

    Worked fine. thank you.

Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: Whats wrong in this javascript

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