I have the below code, the principle being that when clicking on the < td > it gives two alert boxes:
1)with the data-value (e.g. 1)
2) with the text (11001)
but when I click on it I get the follwoing error for the 'type' variable:
function ( value ) {
return jQuery.access( this, function( value ) {
return value === undefined ?
jQuery.text( this ) :
this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) );
}, null, value, arguments.length );
}
I'm assuming it is something quite obvious, but I can't see what???
<html>
<head>
<script language="JavaScript" src="../Generic/JAVASCRIPT/jquery.js" type="text/javascript"></script>
<script>
$(document).ready( function()
{
$('.updatefield').click(function()
{
var typeid = $(this).closest('tr').children('td.rowType1').data('value');
var type = $(this).closest('tr').children('td.rowType1').text;
console.log(typeid);
console.log(type);
}
)
})
</script>
</head>
<body>
<Table>
<tr>
<td class="updatefield rowType1" data-value="1">11001</td>
</tr>
</Table>
</body>
</html>