$(".inform_method").select(function(e) {
e.preventDefault();
var id = e.currentTarget.dataset.id;
var val = $(".inform_method").val();
switch (val) {
case "call":
$("-sharpinform_"+id).attr("name", "phone_number").attr("placeholder", "");
break;
case "email":
$("-sharpinform_"+id).attr("name", "email_address").attr("placeholder", "");
break;
case "fax":
$("-sharpinform_"+id).attr("name", "fax_number").attr("placeholder", "");
break;
}
});
<select data-id="<?=@$key->{"restaurant-id"};?>" name="inform_method" class="input_edit inform_method">
<option>---</option>
<option value="call"></option>
<option value="email"></option>
<option value="fax"></option>
</select>
<textarea id="inform_<?=@$key->{"restaurant-id"};?>" name="" class="input_edit" placeholder=""></textarea>
I want to catch what kind of value, I used and then do the corresponding thing? Why is it impossible to do so?
if it is not right to change the top select to click, you will have to press it again after clicking it.