0
我有这段代码的问题:调用一个jQuery中的JavaScript函数生成<a href...>
$(document).ready(function() {
$('.notActiveId').change(function() {
if ($(this).attr('value').length === 0) {
$("#notActiveButton").html('');
} else {
$("#notActiveButton").html('<a href="javascript:void(0)" onClick="setStatus(' + $(this).attr('value') + ', activate)" class="operationUnlock" >Activate</a>');
}
});
});
我与$(this).attr('value')
从名为notActiveId
选择列表中的值调用。但问题是如何在setStatus()
函数中编写$(this).attr('value')
函数,因为我的select的值是这种形式的:RZT_83848Rer
(所以它由字符,下划线和数字组成)。
如果我试图按照上面的方式编写它,那么我得到一个JavaScript错误。
你能告诉我们一些HTML代码吗? – 2011-04-10 00:07:19