How can I display an image caption within a lightbox using jQuery?

There is a caption under each image.

<p>
<a href="large.jpg"> 
<img width="85" height="75" src="thumb.jpg/>
</a>Caption</p>

I am looking to display the same caption at the bottom of the lightbox.

<span id="lightbox-image-details-caption">...Here.......</span>

Is there a way to achieve this?

Answer №1

One way to ensure your link has a title attribute is by including it directly in the HTML code:

<p>
<a href="large.jpg" title="Your Description"> 
<img width="85" height="75" src="thumb.jpg" />
</a>
</p>

This title will then appear within

<span id="lightbox-image-details-caption"></span>
. Is this approach suitable for your needs, or do you prefer adding text after the image as demonstrated here?

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

What is the reason behind Material UI's decision to utilize display flex instead of display grid?

The Grid component implements the grid system. It leverages the Flexbox module in CSS to provide great flexibility. What is the reason behind material UI using display flex instead of display grid? ...

Why isn't the AngularJS injected view resizing to fit the container?

As a novice delving into a project in the MEAN stack, I'm encountering inconsistent HTML previews. When I view it independently versus running it from the project, the display varies. Here's the intended appearance (in standalone preview): imgu ...

The validation of class names in jQuery is not functioning correctly for text fields that are dynamically

I am currently experiencing an issue with jQuery Validation in regards to validating dynamically generated text fields through AJAX... Highlighted below is a snippet of the HTML code: <form name="booking" id="booking" method="post" action=""& ...

There has been an issue with parsing the JSON file due to an invalid character found at

I keep encountering a parse error whenever I attempt to send a post request to the server. $.post("../php/user_handler.php", formData, function(data) { var result = JSON.parse(data); if(result.status === 'error') { ...

Enhance your website with the jQuery autocomplete feature, complete with

Is there a way to incorporate smaller text descriptions alongside the search results displayed on my website? The descriptions are available in the data array used by autocomplete and can be accessed using the .result function by calling item.description. ...

Sync JSON object modifications with the DOM using jQuery (or potentially other libraries)

I am working on developing a web application that would be able to update the HTML elements based on changes in a JSON object. For instance, I have an unordered list with data attributes: <ul data-id="elements"> <li data-id="01">Element 01< ...

Tips for iterating through a collection of arrays with jQuery

I am facing an issue with looping through an array of arrays and updating values or adding new keys to each array. Here is my current setup: var values = []; values['123'] = []; values['456'] = []; values['123&apo ...

What is the best way to showcase a chart using jquery?

Is there a way to incorporate trendlines or target lines in highcharts similar to fusion chart? I have been able to draw them successfully in fusion charts. Check out this fiddle link: http://jsfiddle.net/Tu57h/139/ I attempted to recreate the same in hi ...

Unable to access the suggestion list within the modal

I incorporate the PrimeNG AutoComplete feature within a PrimeNG Dialog, displaying a list of elements below the AutoComplete in the dialog. My objectives are: To set the max-height of the modal dialog to 300, and have a visible scrollbar if the total ...

I am searching for a way to apply a conditional class to the chosen element in react, as the toggle method does not

I'm working on customizing a dropdown menu and I want to add a functionality where if a parent li menu has an arrow class before the ul element, then clicking on that parent li menu will add a class called showMenu only to that specific sub-menu. Her ...

Revisiting a jQuery ajax call using the response text

I have been attempting to implement ajax in the following way; Here is the jQuery code I am using: $("a.generate").click(function(){ $.ajax({ data: {tag: $(this).html()}, success: function(data){ $("#terms div.content").ht ...

Using Python Flask: Passing a Python list of data elements to Jquery's "Lists": [{ [] }]

Seeking assistance in passing a Python List Result to a Jquery List. Can anyone provide the necessary code to integrate jinja templates into Jquery for iterating through the List values? Python Flask Code:- @app.route('/mapcolumns_link',methods ...

Creating an anchor tag in ASP

Could someone please review the code snippet below? I am trying to make a hyperlink with the agency id passed through, but it doesn't seem to be displaying properly. Your help is appreciated. $('#agency' + parentAgency.id).append( &apos ...

Error: Knockout sortable array failing to render nested elements accurately

As a newcomer to Knockout.js, I have recently delved into the world of JQuery and the knockout-sortable project. My current project involves utilizing a complex data structure to present forms. Specifically, I am attempting to create a nested sortable arra ...

Tips for preventing HTML ID clashes while integrating with the Document Object Model of external websites

When incorporating additional HTML elements into a webpage using Javascript or jQuery, along with external CSS declarations, it is important to avoid conflicts with existing IDs and class names already present on the page. This could lead to issues if ther ...

The CSS styles are functioning correctly in index.html, but they are not applying properly in the component.html

When the UI Element is clicked, it should add the class "open" to the list item (li), causing it to open in a collapsed state. However, this functionality does not seem to be working in the xxx.component.html file. Screenshot [] ...

Angular: Intercept Drag and Drop Actions

I am utilizing angular-ui to create a sortable list using "drag and drop" functionality, and it is functioning perfectly. Here is an example of how it works: index.html <ul ui-sortable ng-model="list"> <li ng-repeat="item in list" class="it ...

Position the Bootstrap button at the bottom left with absolute placement

Currently, I am utilizing Django as my web framework and Bootstrap to enhance the rendering of the frontend. My goal is to implement an "add" button on my page that will always be in the bottom left corner regardless of scrolling, overlaying any other cont ...

JavaScript AJAX request not triggering properly

I'm encountering an issue with my code for retrieving data from MySQL. It seems that the ajax part is not working properly, as the 'ttt' alert is not being displayed. What could be causing this problem? function autoFill() { var claiman ...

Tips for modifying the color of the last anchor in a list item

li elements are utilized to create breadcrumb in a shopping cart. The breadcrumb displays all anchor elements using the style defined for an 'a' element from site.css. How can I make the last anchor's color black? I attempted the style belo ...