DEV Community

ZaakaJarimbo
ZaakaJarimbo

Posted on

Why has this stopped working in JQuery

I had a Javascript which opened a modal and then replaced the .modal-body content with the href content (load an external page into the modal body), however it seems to have stopped working. the script is below:

$('.vs-modal').on('click', function(e){
      e.preventDefault();
//    alert("CLICK RECEIVED"+$(this).attr('href'));
      $('#ViewStarModal').modal('show').find('.modal-body').load($(this).attr('href'));
    });
Enter fullscreen mode Exit fullscreen mode

when the alert is uncommented the alert works so the script is still triggering and it displays the url, but the line after the alert shows the modal but no longer loads the href url


and here is the link/trigger created using php

  <a class='btn btn-outline-success vs-modal' href='view-star.php?id=".$srow['id']."'><i class='bi bi-eye'></i></a>

Enter fullscreen mode Exit fullscreen mode

I just cant see why it has stopped working :(

For some reason I can not post the source for the modal.

USING jquery-3.6.4.js
`

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more

Top comments (0)