This function works when I put it via inline html just before the end of </body>. But once I move it to js/main.js it doesn't work anymore.
Inline:
<script>
var rowNum = 0;
function addRow(frm) {
rowNum ++;
var html = $('.addphone').html();
jQuery('.phone_adds').append(html);
}
function removeRow(rnum) {
jQuery('#rowNum'+rnum).remove();
}
</script>
Versus external .js:
$(function() {
.....other functions...
var rowNum = 0;
function addRow(frm) {
rowNum ++;
var html = $('.addphone').html();
jQuery('.phone_adds').append(html);
}
function removeRow(rnum) {
jQuery('#rowNum'+rnum).remove();
}
});
Error message: Uncaught ReferenceError: addRow is not defined
Help? What is wrong here?
<script src="js/main.js"></script>before the end of</body>