Сообщение от drkrol
|
Извини, не хочу создавать новую тему.
|
и ненужно плодить лишнее.
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
.none{
display: none;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/jquery.formstyler/1.7.6/jquery.formstyler.css">
<script src="https://cdn.jsdelivr.net/jquery.formstyler/1.7.6/jquery.formstyler.min.js"></script>
<script>
$(function() {
var inp = $('input[name="time"]'),
sel = $('select[name="type"]'),
items = $().add(inp).add(sel),
price = $(".price"),
block = $('.priceblock');
items.styler().on("change", function() {
var t = sel[0].selectedIndex,
r = inp.index(inp.filter(":checked")),
num = {
1: {
0: 2500,
1: 500
},
2: {
0: 2800,
1: 800
}
}[t][r] || 0;
price.val(num);
num && block.removeClass('none')
})
});
</script>
</head>
<body>
<select name="type" class="type">
<option ></option>
<option>Тип1</option>
<option>Тип2</option>
</select>
<p></p>
<label>
<input type="radio" name="time" value="yestime" class="rrad">
<div class="rtext">Трубы горят</div>
</label>
<label>
<input type="radio" name="time" value="notime" class="rrad">
<div class="rtext">Время есть</div>
</label>
<input type="text" class="price" value="0" readonly>
<div class="priceblock none">скрытый блок</div>
</body>
</html>