Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 7 of 7
Like Tree5Likes
  • 1 Post By Ronald Roe
  • 1 Post By sarahswansea
  • 3 Post By TheGAME1264

Thread: Why dosnt this function work

  1. #1
    Junior Member
    Join Date
    Jan 2016
    Posts
    11
    Member #
    52924

    Why dosnt this function work

    Code:
    function search(){
                
                //var val = document.getElementById('search').value;
                alert('val');
                
            }


    Code:
    <button id="input2" onclick="search();">lol</button>
    Last edited by Ronald Roe; Jan 30th, 2016 at 08:09 AM.

  2.  

  3. #2
    Senior Member Ronald Roe's Avatar
    Join Date
    Mar 2011
    Location
    Oklahoma City
    Posts
    3,141
    Member #
    27197
    Liked
    959 times
    Because one line is commented out, and the variable name is passed to the alert as a string.
    TheGAME1264 likes this.
    Ron Roe
    Web Developer
    "If every app were designed using the same design template, oh wait...Bootstrap."

  4. #3
    Junior Member
    Join Date
    Jan 2016
    Posts
    11
    Member #
    52924
    that doesnt matter, if the comment line wasnt there the function should alter whats in the string, that dosnt even work

  5. #4
    Senior Member Vapr_Arts's Avatar
    Join Date
    Oct 2013
    Location
    California
    Posts
    1,930
    Member #
    37412
    Liked
    544 times
    Are you not getting any alert box at all? With what you have shown you should get a popup that says "val". If you don't then there is more to this than you are showing us, or it may be that you have js disabled.


    Sent from my iPhone using Tapatalk

  6. #5
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    Or it may be that this function is part of a section of javascript that contains another error and thus cannot be executed.

    Upload the page somewhere so we can see it ourselves. If need be, make a jsFiddle of it.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)

  7. #6
    Senior Member sarahswansea's Avatar
    Join Date
    Oct 2015
    Location
    Swansea, UK
    Posts
    155
    Member #
    52184
    Liked
    65 times
    Hi d9esco,

    If you're using the Chrome web browser, press Ctrl+Shift+i, (that's i for... iguana, icosahedron, iPod, etc.) and it will open up developer tools with a Javascript console which might show you any errors. Other web browsers have a similar thing tucked away in a menu somewhere.

    It might help
    TheGAME1264 likes this.

  8. #7
    Unpaid WDF Intern TheGAME1264's Avatar
    Join Date
    Dec 2002
    Location
    Not from USA
    Posts
    14,483
    Member #
    425
    Liked
    2783 times
    Out of all the posts on here, this might be the first time "icosahedron" has ever been used. I had to Google that. DON'T MAKE ME GOOGLE STUFF.
    If I've helped you out in any way, please pay it forward. My wife and I are walking for Autism Speaks. Please donate, and thanks.

    If someone helped you out, be sure to "Like" their post and/or help them in kind. The "Like" link is on the bottom right of each post, beside the "Share" link.

    My stuff (well, some of it): My bowling alley site | Canadian Postal Code Info (beta)


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 08:43 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com