So, here is my HTML code and jQuery code. I want to pass the value attribute to jQuery so that I can use it as an parameter for my if else loop but I am unable to do so. Here is my sample code.
HTML Code:
<select id="counting" class="normal_button">
<option value="" disabled="disabled" selected="selected">value type</option>
<option value="1">one</option>
<option value="2">Two</option>
<option value="3">Three</option>
<option value="4">Four</option>
</select>
jQuery Code:
jQuery(document).ready(function(){
jQuery("#counting").click(function(){
if (value == "1")
{
jQuery("#text_area").append("<p>Test</p>");
}
else {
jQuery("#text_area").append("<p>Tests</p>");
}
});
});
So here I want that if the options change then the text appended also changes hence I have used value as my parameter for if condition. Also I am appending text to another div text area, is that fine? Can I do that?
I am new to this so please help me. It's showing me the error value is not defined.