Every time a user clicks on a link in a list view unordered list, a simpledialog2 box should appear. Here is the link to simpledialog2 documentation. It’s a popular way to support popboxes in jQuery Mobile applications. http://dev.jtsage.com/jQM-SimpleDialog/demos2/index.html
However, no dialogue box is showing up in my code. Why?
This Fiddle contains my code.
http://jsfiddle.net/ykHTa/2/
Here is my HTML.
<ul data-role="listview">
<li><a href="#">foo</a></li>
<li><a href="#">bar</a></li>
<li><a href="#">baz</a></li>
</ul>
Here is my javascript.
$(function() {
// When user clicks on a list item, produce a dialogue/alert box.
$('[data-role="listview"] a').click(function(event) {
event.preventDefault();
$('<div>').simpledialog2({
mode: 'blank',
headerText: "Popup title",
headerClose: true,
blankContent:
"My message to you."
});
});
});
David, your javascript example is missing a closing parenthesis here:
UPDATE
I got it working in your example (jsfiddle) by adding this to your simpledialog2 method call:
Based on documentation here: http://dev.jtsage.com/jQM-SimpleDialog/demos2/dialog.html
Hope this helps!