1

I am struggling since a few days with following problem. Using Joomla 3.9.2x and query 3.5.1. I am trying to display a modal "window" when an item is selected in a Joomla filelist field. I tried a few triggers like:

jQuery(document).ready(function(){ 
    jQuery("#jform_myfile_chzn").click(function(){
        UIkit.modal('#displayimage').show();
    });
});

After loading the page and the file is selected, it works. Obviously with "click", it shows "#displayimage" each time it is clicked and not only when the file is selected.

I tried a few others like "change", but I can't make it work.

1
  • Welcome to JSE. Thank you for taking the tour; perhaps consider telling us a little about you and your Joomla story by editing your profile. Please continue to work at your issue. If you discover more relevant clues, please edit your question. If you manage to solve the issue yourself, please post an educational answer that will help future researchers with a similar issue. Commented Sep 15, 2020 at 2:43

1 Answer 1

2

Put the event listener on the underlying hidden select field not on the chozen ui element. The id of the select will be the same id without the _chzn suffix.

jQuery(document).ready(function(){ 
    jQuery("#jform_myfile").change(function(){
        UIkit.modal('#displayimage').show();
    });
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.