我想根据用户在表单上的选择更改按钮(提交)上的data-confirm属性的值。我把一个下拉列表的变化功能如下:覆盖数据 - 确认值
...
if($("#"+select_name).val() == "abc")
{
$(".variable_button").attr("data-confirm","abc is good choice!");
} else
{
$(".variable_button").attr("data-confirm","abc would have been great but this is fine too...");
}
...
我面临的问题是,一旦它被赋予一个非空字符串,显然数据确认,不能更改。我已将它设置为“”在服务器代码中。并且,当用户首先在下拉列表上进行选择时,它会变为上面显示的两条消息之一。但是如果用户再次更改选择,则数据确认消息不会改变。这是每个设计还是我错过了什么?
'data-confirm'属性只是您用来存储消息的自定义'data-'属性,对吗? – 2012-01-04 21:09:41
乔希 - 是的,这是正确的。 – Tabrez 2012-01-04 21:24:04