I am very new to HTML/javascript. I'm attempting to create a form with four fields: the first field (texta) is readonly, the second field (selectiona) is a dropdown list, the third field (textb) is readonly, and fourth field (sentence) is a concatenation of the three other fields. I can't figure out why my javascript isn't working:
<script>
$('#texta, #selectiona, #textb, #selectionb').bind('keypress blur', function() {
$('#sentence').val($('#texta').val() + ' ' +
$('#selectiona').val() + ' ' +
$('#textb').val() + ' ' +
$('#selectionb').val() );
});
<script>
<p>Text A:<input id=texta readonly value="My favorite car is a: "></p>
<p>Selection A: <select id=selectiona>
<option>Select...</option>
<option>Toyota</option>
<option>Honda</option>
</select></p>
<p>Text B: <input id=textb readonly value="because they are "></p>
<p>Selection B: <select id=selectionb>
<option>Select...</option>
<option>reliable.</option>
<option>fun to drive.</option>
</select></p>
<p>Sentence: <input id=sentence readonly></p>