guys!
I am really doing my best to solve the problem below, but after many hours I am not able to see the correct path to go! Let me explain:
- I have a element a-href (#opener) that, when clicked, fires a jQueryUI modal dialog who loads through ajax a URL inside a div (#target).
- Everything works perfect, but I want this to happen once!
- After loading the modal window I was able to set a class (.deactivated) to my #opener a-href and to remove the id (#opener) to prevent the action to be fired again, however it does not work... the a-href remains clickable and opening the modal window (#target) as many times as I click on it!
- The only solution I found was to remove the a-href completely from the DOM --- using $(this).fadeOut(); ---, but it is really ugly, since my link #opener just vanishes in thin air.
Any ideas? Thank yo sooo much. G.
<script>
$(document).ready(function() {
$('#opener').click (function() {
$('#target').load ('http://my.url', function(){
$('#target').dialog({
title: 'My Title',
draggable: true,
dialogClass:'My Class',
modal: true,
hide: { effect: 'fade', speed: 'fast' },
show: { effect: 'fade', speed: 'fast' },
closeOnEscape: true,
closeText: 'Close',
beforeClose: function(event, ui) {
'window.location.reload(true)'
},
});//end dialog
});
$(this).addClass('.deactivated');
$(this).removeAttr('id');
});
});
on/off
; use ONLY one time and never again - utilizeone
function – Lucero