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
What is difference between local and global scope in javascript ?
Write the point of difference between web-garden and a web-farm?
Which software is best for javascript?
What are the advantages of using JavaScript?
Why is javascript hoisting?
What is whitespace in javascript?
How to call a function inside a function in javascript?
What kind of conditional statements does JavaScript support?
What is Number object in JavaScript?
How many days it will take to learn javascript?
What does _ mean in javascript?
Can I open javascript on iphone?
When would you use var in your declaration and when you wouldn’t?
Difference between Client side JavaScript and Server side JavaScript?
How to make a function in javascript?