Updated code, trying to change the imo number with an onclick but vesslefinder just ignores everything in the onclick. Any advivce? Even when I hard code the imo it doesn't work.
The <a>
'button' link:
<a id="button_mssi_imo" href="#" data-toggle="modal" data-target=".bs-example-modal-lg" class="btn btn-success btn-xs"><i class="fa fa-truck"></i><p hidden="">9514767!</p> Track </a>
script:
<script>
$(document).on('click', '#button_mssi_imo', function( event )
{
alert('Button Clicked');
var imo_data = $(this).text();
// splits the string to get the imo
var imo_data_split = imo_data.split("!")[0];
var width="700";
var height="500";
var zoom="3";
var imo = imo_data_split;
var click_to_activate=false;
});
</script>
<script type="text/javascript" src="https://www.vesselfinder.com/aismap.js"></script>
I am trying to append some JavaScript into a div when a button
is clicked (To use vesselfinder). I can manage to append the start of the script, but the second I start to add var
it comes back with the unrecognised expression
message.
Could anyone please help me to what I am doing wrong? I have also tried everything on one line that results in the same error: