Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Css jquery标记it插件';s输入字段样式_Css_Tags_Tag Cloud_Tag It - Fatal编程技术网

Css jquery标记it插件';s输入字段样式

Css jquery标记it插件';s输入字段样式,css,tags,tag-cloud,tag-it,Css,Tags,Tag Cloud,Tag It,html <p> Tags:<input name="tags" id="tags" /></p> 我想控制输入字段的大小,我该怎么做 (function( $ ) { $.fn.extend({ tagit: function (params) { return this.each(function () { console.log(params); console.log(params

html

<p> Tags:<input  name="tags" id="tags" /></p>
我想控制输入字段的大小,我该怎么做

(function( $ ) {
  $.fn.extend({
    tagit: function (params) {

       return this.each(function () {
          console.log(params);
          console.log(params['tagLimit'] );          
          $(this).attr('maxLength', params.tagLimit );
          $(this).parent().css('maxwidth', params.tagLimit );
          $(this).parent().css('width', params.tagLimit );

       });


   }
 } )

}( jQuery ));
但您也可以通过jQuery直接完成,如下所示:

 var _width = 3;
 $("p input").each( function() {
    $(this).css('width', _width);
    $(this).css('maxWidth', _width);
})

如果查看由tagit插件生成的动态HTML,ul.tagit是分配给生成的ul的类。因此,要在CSS集中将宽度设置为200px:

ul.tagit {
    width: 200px;
}

因为我已经在多个地方使用了标签,所以我决定用Javascript来做。大小必须足够大,以便在添加标记时不会出现双线。基本准则是:

    // adjust tag it size
    $("ul.tagit").attr("style", "width:450px;")
当然,你也可以选择450px以外的东西

然而,我还想将它与其他jqueryui按钮(我用ul而不是li来设计)对齐,这样它们就可以与搜索框非常贴合。需要调整底部边距,使其与按钮更精确地对齐。这是代码

    // adjust tag it size and line it up with buttons
    $("ul.tagit").attr("style", "width:450px; display:inline-block; margin-bottom:-10px")

您希望创建一个名为tagit的jQuery插件,是吗?我只想给输入字段(显示标记的外部框)指定大小,比如200 px。对不起,我现在调整了解决方案。现在它也可以用于多个实例。再次抱歉,我之前做了一件麻烦的事,但现在它真的工作并经过测试。兄弟,你没有理解我的意思。我想知道输入标签的外框的宽度@developer3466402
    // adjust tag it size and line it up with buttons
    $("ul.tagit").attr("style", "width:450px; display:inline-block; margin-bottom:-10px")