Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
194
rated 0 times [  196] [ 2]  / answers: 1 / hits: 16581  / 7 Years ago, fri, march 10, 2017, 12:00:00

I have 2 bootstrap buttons, I is a direct link to another page on the website and the other one I want to activate a javascript onclick event. I have no problem with a basic link but when adding it to a button it doesnt seem to work? I have included the code I am using with the link thats works but the button doesnt.



The code is :



<div style=margin-top:10px class=form-group>
<!-- Button -->
<div class=col-sm-12 controls>
Are you already registered?
<a href='login' button type='button' class='btn btn-block btn-success'><span class='glyphicon glyphicon-user'></span> Login</button></a>
<div class=spacing3></div>Not yet?

<button id='next' name ='next' type='button' class='btn btn-block btn-primary'>Continue</button>
</div>
</div>

<a href=# onClick=$('#loginbox').hide(); $('#1box').show()>Login here</a>


And the js for the button is



$(document).ready(function() {
$('#btn-next').on('click', function() {
$('#loginbox').hide(); $('#1box').show();
}
      


   


More From » button

 Answers
71

change this



<button id='next' name ='next' type='button' class='btn btn-block btn-primary'>Continue</button>


to



<button id='btn-next' name ='next' type='button' class='btn btn-block btn-primary'>Continue</button>


as you are applying event on btn-next ID $('#btn-next').on('click'


[#58594] Wednesday, March 8, 2017, 7 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
arlethjeanettep

Total Points: 506
Total Questions: 96
Total Answers: 79

Location: Liberia
Member since Tue, Mar 14, 2023
1 Year ago
;