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

Can you assign an anonymous function to a variable and pass it as an argument to another function?

0 Answers  


What are different types of popup boxes available in javascript?

0 Answers  


What is the difference of "settimeout" function and setinterval functions in javascript

0 Answers  


Can an anonymous function be assigned to a variable?

0 Answers  


Which built-in method removes the last element from an array and returns that element?

0 Answers  






How to detect the OS on the client machine in JavaScript?

0 Answers  


How can you get the total number of arguments passed to a function?

0 Answers  


Do you have to declare variables in javascript?

0 Answers  


Are Attributes and Property the same?

0 Answers  


Is javascript safe to download?

0 Answers  


Why we use java script when java also supports validation?

1 Answers  


Where do I put javascript in html?

0 Answers  


Categories