So this is a working jQuery dialog, which is activated by pressing button with id #opener:
- Code: Select all
<script type="text/javascript">
$(document).ready(function() {
var $dialog = $('<div></div>')
.html('This dialog will show every time!')
.dialog({
autoOpen: false,
title: 'Basic Dialog'
});
$('#opener').click(function() {
$dialog.dialog('open');
// prevent the default action, e.g., following a link
return false;
});
});
</script>
<button id="opener">Open the dialog</button>
Now I want to open it with clicking an image, not button.
Basically what I did was substituted ".click" function with a new function itself:
- Code: Select all
<script type="text/javascript">
$(document).ready(function() {
var $dialog = $('<div></div>')
.html('This dialog will show every time!')
.dialog({
autoOpen: false,
title: 'Basic Dialog'
});
function show_dialog(){
$dialog.dialog('open');
// prevent the default action, e.g., following a link
return false;
};
});
</script>
<img src="images/edit.jpg" class="edit_set" onClick="show_dialog()">
It should work, but, well, it doesn't xD
Can anyone point me in the right direction?

