What I am trying to do is get the user information that is entered into a text area, to display as a message depending on the degree someone has. So if I check the box for BA the cursor focuses on the BA text area and depending on what I enter: lets say :Science, the message will display as firstName + "You have the following degrees:
BA in Science." or if I check the MA check box and the cursor .focus(es) on the MA text area and I enter Business then it will display as " firstName + "You have the following degrees:
MA in Business." etc. Any help is appreciated.
HTML CODE:
<div id="mycbxs">
<br><strong> </strong>
<br><input type="checkbox" id="BAcbx" value="B"> BA
<br><input type="checkbox" id="MAcbx" value="M"> MA
<br><input type="checkbox" id="PHDcbx" value="P"> PHD
</div>
<div id="myinputs">
<br><strong>Discipline</strong>
<br><input type="text" id="BAText" size="30">
<br><input type="text" id="MAText" size="30">
<br><input type="text" id="PHDText" size="30">
<br><br>
<input type="button" id="myclick" value="Submit Degree Info">
<br>
<p id="message"></p>
</div>
jQuery CODE:
$(document).ready(function(){
$("#myclick").click(function(){
var myFirst = $("#first_name").val().trim();
$("#first_name").val(myFirst);
var myMessage = myFirst + "." + " You have yet to earn any degrees.";
if(!myFirst)
{
$("#message").text() = "";
}
else
{
$("#message").text(myMessage);
}
});
$("input[type='checkbox']").click(function(){
var radioButtonsChecked = $("#mycbxs input[type ='checkbox']:checked").val();
$("#myinputs input[type ='text']").val();
if(radioButtonsChecked == "B")
{
$("#BAText").focus();
}
if(radioButtonsChecked == "M")
{
$("#MAText").focus();
}
if(radioButtonsChecked == "P")
{
$("#PHDText").focus();
}
});
$("#myclick").click(function(){
var myFirst = $("#first_name").val().trim();
$("#first_name").val(myFirst);
$("#myinputs input[type ='text']").val();
var myDegree = '';
var radioButtonsChecked = $("#mycbxs input[type ='checkbox']:checked").val();
var myMessage = myFirst + "." + " You have yet to earn any degrees.";
if(!myFirst)
{
$("#message").text() = "";
}
else
{
$("#message").text(myMessage);
}
if(radioButtonsChecked == "B")
{
myDegree = $("#BAText").val();
}
if(radioButtonsChecked == "M")
{
myDegree = $("#MAText").val();
}
if(radioButtonsChecked == "P")
{
myDegree = $("#PHDText").val();
}
var myMsg = myFirst + " You have the following degrees:" + "<br>" + "<br>" + myDegree;
$("#message").html(myMsg);
});
});