How to get an event from button in jquery mobile dynamic page

I have created a dynamic page using jquery mobile, how to get an event after creating this page? Also i need an alert from this button.

this is my code:

$("#test").on('click',function(){ var newPage = $("<div data-role=page data-url=testpage><div data-role=header> <h1>TEST</h1></div><div data-role=content> <input type='button' value='clic kMe' id='click_me'> </div></div>"); newPage.appendTo( $.mobile.pageContainer ); $.mobile.changePage( newPage ); });


Use this:

$(document).on('click','#click_me',function() { alert('Click'); });

or in case of your code:

$("#test").on('click',function(){ var newPage = $("<div data-role=page data-url=testpage><div data-role=header><h1>TEST</h1></div><div data-role=content> <input type='button' value='clic kMe' id='click_me'> </div></div>"); $(document).on('click','#click_me',function() { alert('Click'); }); newPage.appendTo( $.mobile.pageContainer ); $.mobile.changePage( newPage ); });


  • After redirct url pagination not working
  • Puppeteer opening chrome instance for each file at once
  • Why Open Redirect URLS?
  • $(“body”).ready() works but $(“body”).load() does not work?
  • Change navbar in bootstrap if user login
  • Yii2 Login with database
  • Action Pack components in Rails
  • How does document.ready work with angular element directives?
  • Button click event not firing in jQuery
  • FileReader+canvas image loading problem
  • Insert into database using onclick function
  • Display issues when we change from one jquery mobile page to another in firefox
  • Deselecting radio buttons while keeping the View Model in synch
  • Why ng-show works with ng-repeat but ng-if doesn't? [duplicate]
  • Why HTML5 Canvas with a larger size stretch a drawn line?
  • JSON with duplicate key names losing information when parsed
  • jquery mobile loadPage not working
  • Jquery - Jquery Wysiwyg return html as a string
  • Data Validation Drop Down Box Arrow Disappearing
  • How to delete a row from a dynamic generate table using jquery?
  • Benchmarking RAM performance - UWP and C#
  • Acquiring multiple attributes from .xml file in c#
  • using HTMLImports.whenReady not working in chrome
  • How do you join a server to an Active Directory (domain)?
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • embed rChart in Markdown
  • Authorize attributes not working in MVC 4
  • How can I remove ASP.NET Designer.cs files?
  • EntityFramework adding new object to nested object collection
  • How to get NHibernate ISession to cache entity not retrieved by primary key
  • costura.fody for a dll that references another dll
  • Binding checkboxes to object values in AngularJs
  • Observable and ngFor in Angular 2
  • How can I use `wmic` in a Windows PE script?
  • UserPrincipal.Current returns apppool on IIS
  • Unable to use reactive element in my shiny app
  • java string with new operator and a literal
  • Net Present Value in Excel for Grouped Recurring CF
  • jQuery Masonry / Isotope and fluid images: Momentary overlap on window resize
  • How to load view controller without button in storyboard?