show the date in textbox when we select item (items like--
today,yesterday,lastweek,lastmonth,lastyear) from
dropdownlist using javascript?



show the date in textbox when we select item (items like-- today,yesterday,lastweek,lastmonth,lasty..

Answer / syed ahmed jawwad

<!--- Include Jquery Script, source www.jquery.com--->
<select id="dayType" name="dayType" onchange="showFields()">
<option>Today</option>
<option>Yesterday</option>
<option>Last Week</option>
<option>Last Month</option>
<option>Voucher Number</option>
</select>
<input type="text" id="dateValue" name="dateValue">
<script type="text/javascript">
function showFields()
{
if(jQuery('#dayType').val()=='Today' ||
jQuery('#dayType').val()=='Yesterday')
{
jQuery('#dateValue').datepicker({changemonth:
true, changeyear: true, dateformat:'mm/dd/yy'});
}else jQuery('#dateValue').datepicker('destroy');
}
</script>

Is This Answer Correct ?    3 Yes 0 No

Post New Answer

More JavaScript Interview Questions

What is the difference between null and undefined?

1 Answers  


Can you assign an anonymous function to a variable?

0 Answers  


How to convert a string to a number using javascript?

0 Answers  


if the two text boxes are there i want assign the vales like 2&3 and if i select button means i want find the sum.this is client side scripting in javascript

7 Answers   Infosys,


What is the difference between let and var?

0 Answers  


What are the main uses of javascript?

0 Answers  


What is enum in javascript?

0 Answers  


How many types of data types are there?

0 Answers  


What is the difference between undefined value and null value?

0 Answers  


How to prevent a window not to be clicked or selected any way in java script?

0 Answers  


I am providing the Online& class room training on Worksoft Certify for SAP/HTML/JAVA using real time scenarios in a real time environment for a real time project, If any one is interested please get in touch with me on aimansaud@gmail.com

0 Answers   Intel,


WHAT IS .NET?

1 Answers  


Categories