<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>attributeContainsPrefix demo</title>
<script src="https://code.jquery.com/jquery-3.5.0.js"></script>
</head>
<body>
<select id="selectName">
<option selected disabled value=""></option>
<option amount="20"> OPen </option>
<option amount="30"> OBS </option>
<option amount="50"> SC </option>
</select>
<label id="amountInputBox" ></label>
<script>
$('#selectName').change(function(){
var amount=$('#selectName option:selected').attr('amount');
$("#amountInputBox").text(amount);
});
//var abcd=$( "option[amount]" ).val();
</script>
</body>
</html>
No comments:
Post a Comment