Today i was looking how to do jQuery alert, like i do it on every javascript. Well, its the same, you can simply use:
$("li").click(function(){
var current_id=$(this).attr('id');
alert(current_id);
// these alert two times one is empty another one is content_1
});
But then again, this is only usefull when programing. I went for a search for best jQuery plugins to do some proper jQuery alert dialogs. This is the first one i found:
jqModal is a lightweight window plugin written for jQuery which improves & makes easier the use of windows. jqModal is a plugin for jQuery to help you display notices, dialogs, and modal windows in a web browser. It is flexible and tiny, akin to a “Swiss Army Knife”, and makes a great base as a general purpose windowing framework.
But then i found excactly what i was looking for: jquery alert dialogs
This plugin utilizes the $.alerts namespace, but there are three built-in shortcut functions that make implementation easier:
- jAlert(message, [title, callback])
- jConfirm(message, [title, callback])
- jPrompt(message, [value, title, callback])
Unlike their native JavaScript counterparts, you can use HTML in the message parameter. To specify a newline, you can use either \n or <br />
Check out the demo.
