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

why array is called the collection of similar datatypes?

1 Answers  


What is the use of decodeuri() and encodeuri()?

0 Answers  


Is function a data type in javascript?

0 Answers  


What applications use javascript?

0 Answers  


What is difference between promise and callback?

0 Answers  






How to write html code dynamically using JavaScript?

0 Answers  


List some features of javascript.

0 Answers  


Example of using regular expressions for syntax checking in javascript?

0 Answers  


What is the difference between arrow function and normal function?

0 Answers  


Is javascript hard to learn?

0 Answers  


What is the default data type in javascript?

0 Answers  


How are object properties assigned?

0 Answers  


Categories