Reputation: 99
<form name="checkListForm">
<input type="text" name="checkListItem"/>
</form>
<div id="button">Add!</div>
<br/>
<div class="list"></div>
<script>
$(document).ready(function(){
$('#button').click(function(){
var toAdd = $('input[name=checkListItem]').val();
$('.list').append('<img src="http://latex.codecogs.com/gif.latex?\frac{x} {y}"/>');
});
$(document).on('click', '.item', function(){
$(this).remove();
});
});
</script>
So I have this form right here that when I press the button should append this latex equation to the html element .list. But insted of that i got this I'm using this lates equation js file form codecogs: codecogs.com/latex/htmlequations.php
Upvotes: 0
Views: 261
Reputation: 1145
You need to escape the \
character in your line:
$('.list').append('<img src="http://latex.codecogs.com/gif.latex?\frac{x}{y}"/>');
So, go ahead and change it to:
$('.list').append('<img src="http://latex.codecogs.com/gif.latex?\\frac{x}{y}"/>');
In your version, you are trying to escape the f
character which is incorrect.
Upvotes: 2