Jquery Selector worked Once and Not working Again. "All Selector "

+6 Ezubelu Anthony · June 11, 2015
I wrote an external jquery code selecting an  ID on an Onclick event, and it works and stopped. then i change its ID to a class and it worked again and stopped. right now, is no longer working. my jquery and javascript are well linked. and my jquery is working, because i tested it using inline and its still working. below are my codes.

<body>
<script type = "text/javascript" src = "http://<?php echo $_SERVER['HTTP_HOST'].'/Trice/TriceMall/Customer/Scripts/javascripts/signup-login.js'; ?>"> </script>

            <script type = "text/javascript" src = "http://<?php echo $_SERVER['HTTP_HOST'].'/Trice/TriceMall/Scripts/jQuery/jQuery.js'; ?>"> </script>

 <div id = "signup-login-button">
                 <table>
                        <tr>
                            <td>
                                <button type = "submit" size = "30" class = "button-login" id= "login-home-button">Login</button>
                            </td>
                        </tr>

                        <tr>
                            <td>
                                  <button type = "submit" size = "30" class = "button-login" id = "signup-home-button">Sign Up</button>
                            </td>
                        </tr>
                 </table>
            </div>


</body>

MY SCRIPT CODE IS AS FOLLOWS:

$('#login-home-button').click(function(){
  
     $('#login-home-button').hide();

  });

please i need serious help. i have a project to complete. 

Post a Reply

Replies

- page 1
Oldest  Newest  Rating
+1 Abdullah Nauman · June 11, 2015
I would recommend the toggle command instead. its more practical for this use. 

http://www.w3schools.com/jquery/tryit.asp?filename=tryjquery_toggle




$('#login-home-button').click(function(){
        $("#login-home-button").toggle();
    });
});

0 Ezubelu Anthony · June 26, 2015
please is not working. it only works when i set it as a function. and at the body i will use the onload.

    <body onload = 'click();'>

</body>
0 Ezubelu Anthony · June 26, 2015
function click(){

$(document).ready(function(){

$('#login-home-button').click(function(){
                                          
                                               $('#login-home-button').hide();
                                          });

});
}
0 Marco Schindler · September 6, 2015
Please describe how it is supposed to work.

For me it is doing what it is supposed to do.
Hide the Login button on click.

If I reload the page I can hide it again.

http://codepen.io/anon/pen/OyPqGx

Please further describe your issue.
0 Aron Agfay · July 1, 2015
<body onload = 'click();'>

i do not get this...is it like this:

 window.onload=click;

?
0 Ezubelu Anthony · June 27, 2015
please help is needed urgently....
0 Ezubelu Anthony · June 11, 2015
the issue is that, its not hiding but let me give yours a try. 
0 Ezubelu Anthony · August 28, 2015
still waiting
0 Ezubelu Anthony · August 3, 2015
Any Help Still
0 Ezubelu Anthony · June 24, 2015
thanks to all of you. i will try it now. the reason is that i dont know why it cant work for me.
  • 1
  • 2

Javascript

106,950 followers
About

A scripting language that is added to standard HTML to create interactive effects, apps, games for the browser.

Links
Moderators