I am currently testing a form that I am in the process of developing. My goal is to have different values returned each time I click on a different item from the dropdown menu. If this explanation isn't clear, please take a quick look at my pen for clarification here
var val1 = $("#box1 p:first-child").text()
var val2 = $("#box2 p:first-child").text()
$("#box1").click(function(){
$("#dropdown2").removeClass('appear')
$("#dropdown1").toggleClass('appear')
})
$("#dropdown1 ul li a").click(function(){
$("#box1 p:first-child").text($(this).text());
$("#box1 p:first-child").val($(this).text());
alert(val1)
})
Every time I click on Placeholder 1, 2, or 3, they all just display "Placeholder" instead of their full text. For instance, clicking on "Placeholder 1" should show "Placeholder 1" and not just "Placeholder."
I would greatly appreciate any assistance as I am completely stuck.