0

so I have a popup form directly from the jquery mobile website, displayed below. Then in my script file I have a call that is intended to fire on button click. I'm not sure why it is happening.

popup form:

  <div data-role="popup" id="popupLogin" data-theme="a" class="ui-corner-all">
    <form>
        <div style="padding:10px 20px;">
            <h3>Please sign in</h3>
            <label for="un" class="ui-hidden-accessible">Username:</label>
            <input name="user" id="un" value="" placeholder="username" data-theme="a" type="text">
            <label for="pw" class="ui-hidden-accessible">Password:</label>
            <input name="pass" id="pw" value="" placeholder="password" data-theme="a" type="password">
            <button id="admin_btn" class="ui-btn ui-corner-all ui-shadow ui-btn-b ui-btn-icon-left ui-icon-check">Sign in</button>
        </div>
    </form>
  </div>

The button tag used to be of type "submit", but decided to take that out and make it a generic button, where i will just test if it is clicked through the ID. Not sure if that means anything.

script.js:

$(document).ready()
{
    $('#admin_btn').click(function(){
        alert("Here");
    });  
}
Andrew Ricci
  • 475
  • 5
  • 21

1 Answers1

0

Use these code:

$(document).ready()
{
$(document).on("click","#admin_btn",function(){
    alert("Here");
});  
}

You can check the difference here link .

Community
  • 1
  • 1
Homen
  • 1,222
  • 1
  • 12
  • 16