Click here to Skip to main content
15,900,725 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Team,


i have the Jquery Form.
i have salary textbox. sometimes salary textbox is empty so i want to put zero instead of empty salary textbox.

I have tried this but it not works.Kindly help.
customerLoanOcr.Salary == null ? customerLoanOcr.Salary : 0 ;
$('#txtSalary').val(customerLoanOcr.Salary);


Thanks
Harshal Raut
Posted
Comments
Salman622 22-Jan-14 7:55am    
is txtSalary is asp control

1 solution

Try this

it should be
JavaScript
customerLoanOcr.Salary  =  customerLoanOcr.Salary != null ? customerLoanOcr.Salary : 0 ;


if that doesnt works try this..

JavaScript
if (customerLoanOcr.Salary == undefined || customerLoanOcr.Salary == '' || customerLoanOcr.Salary == null)
              customerLoanOcr.Salary = 0;
          $('#txtSalary').val(customerLoanOcr.Salary);
 
Share this answer
 
v2
Comments
[no name] 22-Jan-14 8:19am    
Thanks Buddy for your Quick Response.I got the second option that is
if (customerLoanOcr.Salary == null || customerLoanOcr.Salary == "") {
$('#txtSalary').val(0);
}
else {
$('#txtSalary').val(customerLoanOcr.Salary);


Thanks Brother For tour Help....
Karthik_Mahalingam 22-Jan-14 8:22am    
welcome dude :)
[no name] 22-Jan-14 8:55am    
one question please
Karthik_Mahalingam 22-Jan-14 9:01am    
if it is related to this topic , you can post it..
else you can post a new question, so that other also wil get notified..
sure i wil reply :)
[no name] 22-Jan-14 8:57am    
i am getting value like this in DOB textbox :25-aug-90
$('#txtDOB').val(customerLoanOcr.Dob)

but i want to send it blank ..how can i do this?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900