English 中文(简体)
只读或残疾
原标题:Read-only or disabled the jquery tags

I am using this http://xoxco.com/projects/code/tagsinput/ for my tags input.

But anyone know how to set the div of tags to be read-only mode or disable it?

最佳回答

尝试:

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

if you want to disable the remove X . use this below.

$( .tagsinput ).find( a ).remove();
问题回答

这一工作应当:

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

为使它成为现实,你可以:

$( .tagsinput input ).removeAttr( disabled );

我向另一个争斗者投下这个问题的圈子。 我与大家接受的回答一样,因为这样,在残疾后又能够再次获得治疗是一件容易的事。

我发现一种容易的方法:使用特别安全局。

The following CSS work grand, and don t need JS or mucking the widget s DOM.

.bootstrap-tagsinput.disabled {
    border: none;
    box-shadow: none;
}
.bootstrap-tagsinput.disabled input {
    display: none;
}
.bootstrap-tagsinput.disabled .badge span[data-role="remove"]{
    display: none;
}

如果残疾人:

.bootstrap-tagsinput.disabled .badge {
    background-color: #ccc;
    border: 1px solid #ababab;
}

然后,当你想要做到/可行时,简单地添加或删除<代码>可拆卸的。 中央支助事务组构成这一要素的根基(一个包含<代码>的夹克-标的CSS级)。

代表:

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

或(更好)

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




相关问题
Automatically pick tags from context using Python

How can I pick tags from an article or a user s post using Python? Is the following method ok? Build a list of word frequency from the text and sort them. Remove some common words and pick the top ...

Embed font into PDF file by using iText

I defined a tag map, and got a XML data file. I want to convert the XML data file to PDF by using iText. The question is how to embed fonts (e.g. Polish font, Chinese font) into the target PDF when ...

Splitting a string in C#

I was wondering if somebody could help me use string split to get all occurrences of text in between <p> </p> tags in an HTML document?

Tagging Posts via Wordpress XMLRPC

i am trying to publish a new post to a wordpress blog over the XMLRPC API. This works out fine so far, but now i want to add tags to the post. Either at creation time or afterwards. But i can t find ...

linq query for tag system - search for multiple tags

I have two tables, Tags(tagid, postid, tagname) and posts(postid, name, ...) now i want to make a query that returns me all posts that have a generic amount of tags. like: i want all posts that have ...

Is it sometimes bad to use <BR />?

Is it sometimes bad to use <BR/> tags? I ask because some of the first advice my development team gave me was this: Don t use <BR/> ; instead, use styles. But why? Are there negative ...

iphone - Get dynamically created UITextField by tag

I add a UITextField to a table cell dynamically in my app. I d like to implement a "backgroundClick" method to dismiss the keyboard if the user presses outside the textfield (and outside the keyboard) ...

Re-insertion of <script> tags

Insertion of a file s tag, thus executing the file s code. Removal of the file s tag. Insertion of the same file s tag. Firebug does not seem to acknowledge and does not show the reinserted tag ...

热门标签