I have the following code:
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.pack.js"></script>
</head>
<body>
<select name="size">
<option custAttr="0" value="0" disabled selected>Value ↓</option>
<option custAttr="10" value="10">AAA (10)</option>
<option custAttr="20" value="20">BBB (20)</option>
<option custAttr="30" value="30">CCC (30)</option>
</select>
<label class="result"></label>
<script>
$(document).ready(function() {
$('select').on('change', function() {
$('.result').text(
$('select[name=size]').val()
);
});
});
</script>
</body>
</html>
Actually the script takes the content from value="". Is there a way that the script takes the code from my custom attribute custAttr=""?
.attr()