show the date in textbox when we select item (items like--
today,yesterday,lastweek,lastmonth,lastyear) from
dropdownlist using javascript?
Answer Posted / 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 View All Answers
how do you declare variables in javascript?
Where can I learn javascript for beginners?
How to convert a string to lowercase?
Is it safe to use javascript?
What is Date object in JavaScript?
What is the difference between window and document in Javascript?
What is null in javascript?
What do you mean by enumeration?
Do hackers use javascript?
What is the difference between null and undefined?
What is spread operator?
What is node value?
How do you create array in javascript?
What is a class in javascript?
What is the difference between == and ===? Which one would you use?