te funciona esto?
Código HTML:
<!DOCTYPE html>
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$(document).ready( function (){
$('a').click( function (){
validateUnitItem('asd');
})
});
function validateUnitItem(barCode) {
var unit = $('#U_' + barCode).val();
var itemName = $('#itemName' + barCode).val();
if(unit == 0 || unit == '') {
var cfmZeroUnit = confirm('El Articulo ' + itemName + ' tiene cero unidades, desea quitarlo?');
if(cfmZeroUnit == true) {
deleteItemSale(barCode);
} else {
alert('entre');
$('#U_' + barCode).focus();
}
} else {
$('#barCode').focus();
}
}
</script>
</head>
<body>
<input type="text" value="itemNameasd" id="itemNameasd"><br />
<input type="text" value="U_asd" id="U_asd">
<a href="#">link</a><br />
<input type="text" value="var code" id="barCode">
</body>
</html>