I'm having some trouble with some javascript. I'm using jQuery to dynamiclly add rows to a table. Additionally the javascript is being generated from some PHP and Kohana code.
Here is the script.
<script type="text/javascript">
function delExtensionNumber(element){
$(element).prev().attr('value', 'X');
$(element).parent().parent().hide();
}
function addExtensionNumber(){
lines = <?php echo form::dropdown($ext_id."[did]", $lines, ''); ?>;
extensions = <?php echo form::dropdown($ext_id."[extension]", $phones, ''); ?>;
$('#line-extensions > tbody:last').append('<tr><td>'+lines+'</td><td>'+extensions+'</td><td><input type="hidden" name="'+<?php echo $ext_id;?>+'[state]" value="0" /><a class="hide" onclick="delExtensionNumber(this)"></a></td></tr>');
<?php $ext_id++; ?>
}
</script>
This works fine in Firefox. But in IE and Chrome it doesn't work. Nothing happens in google Chrome. In IE I get an error on the page. The error is a syntax error. It doesn't like the < character after the word line.
Ok, so I thought I better put some quotes around this string. But... when I do that nothing works. How do I do this?