user1287923
user1287923

Reputation: 31

button in twitter bootstrap popover not working

I have button in twitter bootstrap popover section and it's id name is 'newbutton'

when i call $('#newbutton').on('click',function(){ alert(123); }); nothing will happen but when i move it outside of popover box its working fine

Here is my code

<img data-placement='bottom' data-content='' title='<button class="close" aria-hidden="true" data-dismiss="modal">×</button> <h5>Login</h5>' class="assesment_islogin"  src="<?php echo base_url() ?>resources/images/mtc_slize_13.jpg" width="103" height="39" />

<div class="pop_login_body"> 
    <div class="alert fade in alert-error"> <button data-dismiss="alert" class="close" type="button">×</button>not logged in yet </div>

    <input type="text" id="inputEmail" placeholder="Email">

    <input type="password" id="inputPassword" placeholder="Password">

    <div class="control-group">
<div class="controls">
<!--<label class="checkbox">
<input type="checkbox"> Remember me
</label>-->
<button type="submit" id="newbutton">Sign in</button>
</div>
<a href="#" class=""> Forget your password</a>
</div>


    </div>

Upvotes: 0

Views: 535

Answers (1)

Kylie
Kylie

Reputation: 11749

Try this...

 $(document).on('click','#newbutton',function(){ alert(123); })

But I noticed you have type="submit" on your button, wont this automatically submit your form??

Thus you would need preventDefault(); as well..

$(document).on('click','#newbutton',function(e){ 
 e.preventDefault(); 
 alert(123); })

Upvotes: 1

Related Questions