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

What are all the types of Pop up boxes available in JavaScript?

0 Answers  


What is an anonymous function in JavaScript?

0 Answers  


What are the methods involved in javascript?

0 Answers  


How can a page be forced to load another page in javascript?

0 Answers  


Auto insurance project..How to explain project in interviews.Using Automation tool (selenium).

0 Answers  






what is the different between html and java?why the java is required in internet?

0 Answers  


How to use one javascript function for multiple input fields?

0 Answers  


Write the code to maximize an image using javaScript?

2 Answers   Infosys,


List few advantages of using javascript?

0 Answers  


What is the dollar sign in javascript?

0 Answers  


What is the difference between java & javascript?

0 Answers  


Does javascript support multidimensional arrays ?

4 Answers  


Categories