am passing variable like fun1(this, 1/0) but am getting values like fun1(this, infinity) in jquery.please advise me how to resove this.
the code as follows:
1.passing parameter
<input type="button" id="cutdel" onclick="javascript:cutdelete(this,2/0)"/>
2.function in use
function cutdelete(button, locGauge) {
$.blockUI({
message: $('#deletewire'),
css: {
width: '360px',
top: ($(window).height() - 1000) / 2 + 'px',
left: ($(window).width() - 360) / 2 + 'px',
backgroundColor: 'none',
border: '3px solid #aaa',
padding: '10px'
}
});
$('#delete').one('click', function() {
loadCart = true;
for (var i = 0; i < selectedgaugeArray.length; i++) {
if (selectedgaugeArray[i] == locGauge) {
selectedgaugeArray.splice(i, 1);
$(button).parent().parent().remove();
break;
}
}
alert(selectedgaugeArray);
$.unblockUI();
return false;
});
$('#save').click(function() {
$.unblockUI();
return false;
});
}
here am passing locGuage as 1/0 , 2/0 ,1:3 but am getting values as infinity. but it working for integer values.
hi all... i am rendaring html content in script itself like
content = content + "<tr class=\"selitems\"><td><input type=\"button\" id=\"cutdel\" style=\"background: #FFFFFF url(images/cutclose.png); width: 14px;height: 14px;border: none;text-align: center;padding: 5px;font-size: 12px;\" onclick=\"javascript:cutdelete(this,"+WireGuage+")\">"+"</input></td>"
here am appending locGuage as onclick=\"javascript:cutdelete(this,"+WireGuage+")\"> in content. so tel me how to convert that as string
Answer:
i passes variable as string
that is: i rendered locguage variable like
var WireGuage ='\''+ $("#WireGuage_"+p).val()+'\'';
the problem solved.
thank u all... thanks for your time.