Tuesday, February 16, 2010

Wiring onchange events using Jquery


If you have a drop-down list of id "choice" with the following values

and you want to populate it's selected value to text box of id "txt" below..

use the following Jquery code


<script language="javascript">
$(document).ready(
function(){
$("#choice").change(function()
{
$("#txt").val($(this).val());
});
}
);
</script>

ok, the idea here was to check if i could run jquery from withing a blog entry - as you would see it is very much possible

No comments: