show the date in textbox when we select item (items like--
today,yesterday,lastweek,lastmonth,lastyear) from
dropdownlist using javascript?
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 |
How to submit a form using JavaScript by clicking a link?
What is NaN in Javascript?
Between JavaScript and an ASP script, which is faster?
What will be the output of the code below? var Y = 1; if (function F(){}) { y += Typeof F;</span> } console.log(y);
What are parameters in javascript?
List some of the disadvantages of javascript.
Is javascript a dynamic language?
Write sample code for pagination using java script.
What is ‘this’ keyword in JavaScript?
What is the context in javascript?
Basic methods for opening a popup window using javascript?
What is the ‘Strict’ mode in JavaScript and how can it be enabled?