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 to add new elements dynamically?
Explain the unshift() method ?
What is event bubbling in JavaScript?
what are the differences between as2 and as3?
What do mean by NULL in Javascript?
How can I request data from the server without reloading the page in the browser?
how to read and write a file using JavaScript?
Is notepad ++ an ide?
what is the difference between window & document in javascript?
Explain few difference between null, undefined or undeclared javascript variable?
Explain the working of timers in javascript?
Is javascript case sensitive?
Explain the terms synchronous and asynchronous code?
Event bubbling and Event Capturing in JavScript?
What are the uses of javascript in web page designing?