I need to open lightbox when clicking on href link.
I tried the following code but it doesn't open the lightbox (the url opens in the same browser).
Would you please let me know how to open lightbox?
Existing code (created by using DWQA plugin):
<div class="dwqa-questions-list">
<div class="dwqa-question-item dwqa-status-answered">
<header class="dwqa-question-title">
<a href="https://www.web.com/question/%ed%94/">Question One</a>
</header>
</div>
<div class="dwqa-question-item dwqa-status-answered">
<header class="dwqa-question-title">
<a href="https://www.web.com/question/%ed%94%8c%/">Question Two</a>
</header>
</div>
</div>
Lightbox code I tried:
The console shows one error:
Unexpected token '<' => <!DOCTYPE html>
?>
<script language="JavaScript" type="text/javascript" src="jquery/jquery.js"></script>
<script>
(function($){
$(document).ready(function() {
$("a", ".dwqa-question-title").click(
function(event) {
event.preventDefault();
var elementURL = $(this).attr("href");
$.colorbox({iframe: true, href: elementURL, innerWidth: 645, innerHeight: 509});
});
});
});
</script>
Thank you.