I want to show my own alert field for iphone using jQuery mobile

I wrote the following code to show my own notification field on iPhone using jQuery mobile + HTML.

alert('ID not Match !'); 

This gives me my own alert, but I want to be able to change the title. Please tell me how to change / give a title in the warning field.

Here's how the warning is displayed in iOS: alert box as displayed on iOS

also see my user dialog. But this does not look like its own warning / dialog: enter image description here

My user dialog does not look native. Please help me.

+8
javascript jquery html5 jquery-mobile image
source share
3 answers
 <div data-role="dialog" id="sure" data-title="Are you sure?"> <div data-role="content"> <h3 class="sure-1">???</h3> <p class="sure-2">???</p> <a href="#" class="sure-do" data-role="button" data-theme="b" data-rel="back">Yes</a> <a href="#" data-role="button" data-theme="c" data-rel="back">No</a> </div> </div> 

And this:

 function areYouSure(text1, text2, button, callback) { $("#sure .sure-1").text(text1); $("#sure .sure-2").text(text2); $("#sure .sure-do").text(button).on("click.sure", function() { callback(); $(this).off("click.sure"); }); $.mobile.changePage("#sure"); } 

You can use them wherever you need a confirmation dialog:

 areYouSure("Are you sure?", "---description---", "Exit", function() { // user has confirmed, do stuff }); 

And also link to this: http://dev.jtsage.com/jQM-SimpleDialog/demos2/popup.html

+1
source share

You can use phonegap / cordova, which will allow you to call navigation.notification.alert , and this will give you your own notification window

You can learn more about this here http://docs.phonegap.com/en/2.7.0/cordova_notification_notification.md.html#Notification

+1
source share

This is for security reasons. You will need to use a special dialog.

0
source share

All Articles