2012-05-11 35 views

Trả lời

9

thử điều này:

$('#tags').tagsInput({ 
     'interactive':false 
     }); 

nếu bạn muốn vô hiệu hóa loại bỏ 'X '. sử dụng dưới đây.

$('.tagsinput').find('a').remove(); 
2

này nên làm việc:

$('.tagsinput input').attr('disabled', 'disabled'); 

Để làm cho nó có thể chỉnh sửa, bạn có thể làm:

$('.tagsinput input').removeAttr('disabled'); 
+4

'prop() 'là mới và tốt hơn jQuery thay thế cho' attr () '. –

+1

Tôi muốn đề nghị '.prop ('disabled', true)' /'.prop ('disabled', false) ', cho các thuộc tính, hoặc, với' attr() ':' attr ('disabled', true) '/' attr ('disabled', false) '. –

+1

Có, prop() sẽ là cách tốt hơn để đi. – techfoobar

1

cho tôi chạy:

var tagsinput = $('#id-tagsinput').next(); 
tagsinput.removeClass('bootstrap-tagsinput'); 
tagsinput.find("input").remove(); 
tagsinput.css("padding-bottom", "10px"); 

hoặc (tốt hơn)

var tagsinput = $('#id-tagsinput').next(); 
$('[data-role="remove"]').remove(); 
tagsinput.find("input").remove(); 
tagsinput.css("padding-bottom", "10px"); 

tạm biệt

+0

Vì vậy, nhiều năm sau đó và đây là một trong đó đã làm những gì tôi đang tìm kiếm. Cảm ơn! – AxleWack

Các vấn đề liên quan