1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Does javascript work on mobile browsers

Discussion in 'JavaScript' started by JEET, May 19, 2016.

  1. #1
    Hi,
    I'm converting a website of mine to be used in mobile phone browsers.
    However, my websites uses a lot of <button> </button> tags and a lot of the following javascript:

    document.getElementById("something").value= "valueHere"; // to update a hidden input field
    document.forms["makepost"].submit(); // to submit forms

    My question is that is this much javascript okay on mobile browsers?
    Or do I need to use plain html to submit forms?
    Thanks
     
    JEET, May 19, 2016 IP
  2. hdewantara

    hdewantara Well-Known Member

    Messages:
    536
    Likes Received:
    47
    Best Answers:
    25
    Trophy Points:
    155
    #2
    Hi JEET.
    It'd be ok I guess, for the former. But for the latter i.e.
    no I never do that either for mobiles / desktops. HTML doesn't need javascript to submit its own form right?

    Another thing about javascript in mobiles is the mouse. Remember that there's no mouse in mobiles :)

    Hendra
     
    hdewantara, May 19, 2016 IP
  3. JEET

    JEET Notable Member

    Messages:
    3,825
    Likes Received:
    502
    Best Answers:
    19
    Trophy Points:
    265
    #3
    Oh, I need the document.forms because when the submit button is clicked, it updates a hidden input field, and then submits the form. I need this hidden value in the $_POST section of php on the next page.
    I hope this will work on mobile browsers like it does in desktop browsers.
    Can someone confirm this please? Or do I need to change the code?
    Thanks :)
     
    JEET, May 19, 2016 IP
  4. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #4
    Mobile browsers support mostly everything javascript (as long as the user hasn't turned it off to save data) so that shouldn't really be a problem.
     
    PoPSiCLe, May 19, 2016 IP
  5. Blizzardofozz

    Blizzardofozz Well-Known Member

    Messages:
    132
    Likes Received:
    9
    Best Answers:
    1
    Trophy Points:
    118
    #5
    Oh yeah! It works! But just check the website on mobile device as it is now :)
    All cool things in mobile websites are javascript mostly. Mobile websites differ mostly in sizing.

    check check check test test test
     
    Blizzardofozz, May 19, 2016 IP