建筑jQuery getting values from multiple selects togetherjQuery的选择列表中,选择的文本价值,而不是我的最后一个问题的价值
我有选择列表,如:
<select name="access" class="change" id="staff_off" runat="server">
<option value="8192">Off</option>
<option value="8192">On</option>
</select>
我基本上要增加或减少的值选项,如果它关闭,减去它是否加上它。这将被存储在cookie中(它使用按位)
jQuery的我已经是:
<script>
$(document).ready(function(){
var currentAccess = $.cookie("access");
})
$("select").change(function() {
var currentText = $(this).text()
var value = $(this).val()
$.cookie("access", value, { expires: 24 });
alert(currentText);
alert($.cookie("access"));
})
</script>
我会做的改变功能的增加。我想不通的事情是如何让选择的文本做一个if语句(所以如果是肯定的,添加值,如果没有,减去值)
汤姆
这正是我所期待的。谢谢! – TMB87 2012-02-08 13:41:14