Hi Im trying to call a javascript function from within a div function
Bascially I have a filter box which adds a bootstrap alert to a textbox and this works perfectly, the issue is when I click the close button on the alert it is not running the specified function and i dont know why
This is the routine which adds the alert to the text box, in it I specify the javascript function to run and 3 variables. the function clear does not seem to get called
//Add Filter on " Add Filters" button click
$("#filter2-add").click(function(){
table.addFilter($("#filter2-field").val(), $("#filter2-type").val(), $("#filter2-value").val());
var div = document.getElementById('appliedfilters');
div.innerHTML += '<div id="'+$("#filter2-field").val()+$("#filter2-value").val()+'" style="width:500px; height:20px;text-align: left;display:inline-block;vertical-align: middle;line-height: normal;" class="alert alert-success alert-dismissible"><a href="javascript:clear(\''+$("#filter2-field").val()+'\',\''+$("#filter2-type").val().charCodeAt(0)+'\',\''+$("#filter2-value").val()+'\')"; class="close" data-dismiss="alert" aria-label="close">×</a><strong>Filter </strong>'+$("#filter2-field").val()+' '+$("#filter2-type").val()+' '+$("#filter2-value").val()+'</div>';
});
javascript:functionName()will call the function namedfunctionNamethat is defined in the global scope - can confirm that it works. In your code, where is the definition ofclear? Please edit your question by removing everything that does not influence the behaviour that you are seeing, format the code and include enough code so that the definition of functionclearis visible, otherwise it's not possible to help you.