5
我使用jQuery 1.3.2,但我已經更新到最新版本:
下列不使用jQuery的最新版本的工作 - 這裏出了什麼問題?
var input = $(this);
// get the associated label using the input's id
var label = $('label[for=' + input.attr('id') + ']');
//get type, for classname suffix
var inputType = (input.is('[type=checkbox]')) ? 'checkbox' : 'radio';
// wrap the input + label in a div
$('<div class="custom-' + inputType + '"></div>').insertBefore(input).append(input, label);
// find all inputs in this set using the shared name attribute
var allInputs = $('input[name=' + input.attr('name') + ']');
感謝它的工作:) – user1177860 2012-07-30 13:04:36
馬克的答案,因爲接受呢:) – 2012-07-30 13:04:52
感謝名單!你節省了我一些時間。從版本1.8.0開始,需要雙引號...... – nightcoder 2013-01-03 13:36:42