如何删除文本和垂直条之间的空格

时间:2016-08-02 07:12:32

标签: jquery html css html5 css3



$('#cmbColumn').editableSelect();
$('#cmbSidebar').editableSelect();

<link rel="stylesheet" href="//cdn.rawgit.com/indrimuska/jquery-editable-select/master/dist/jquery-editable-select.min.css" />

    <script src="//code.jquery.com/jquery-1.12.4.min.js"></script>
   
 <script src="//cdn.rawgit.com/indrimuska/jquery-editable-select/master/dist/jquery-editable-select.min.js"></script>

<!doctype html>


<div class="tabs-outer">
  <div class="tabs-cap-top cap-top">
    <div class="cap-left"></div>
    <div class="cap-right"></div>
  </div>
  <div class="fauxborder-left tabs-fauxborder-left">
    <div class="fauxborder-right tabs-fauxborder-right"></div>
    <div class="region-inner tabs-inner">
      <div class="tabs section" id="main">
        <div class="widget HTML" id="HTML3">
          <h2 class="title"> Search</h2>
          <div class="widget-content">
            <div id="multi-search">
              <select id="cmbColumn" name="cmbColumn">
                <option value="" />Columns
                <option value="apple+" />apple
                <option value="grapes+" />grapes
              </select>
              <select id="cmbSidebar" name="cmbSidebar">
                <option value="" />Sidebars
                <option value="mango+" />mango
                <option value="berry+" />berry

              </select>

              <input onclick=" getValue() " value="Filter" type="button" />
            </div>
          </div>
          <div class="clear"></div>
          <span class="widget-item-control">
                                <span class="item-control blog-admin">
                                    <a class="quickedit" href="https://www.blogger.com/rearrange?blogID=1273768514594589200&action=editWidget&sectionId=main" onclick=" return _WidgetManager._PopupConfig(document.getElementById(&quot;HTML3&quot;)); " target="configHTML3" title="Edit">
                                        <img alt="" src="http://img1.blogblog.com/img/icon18_wrench_allbkg.png" height="18" width="18" />
                                    </a>
                                </span>
          </span>
          <div class="clear"></div>
        </div>
      </div>
      <div class="tabs section" id="main"></div>
    </div>
  </div>
  <div class="tabs-cap-bottom cap-bottom">
    <div class="cap-left"></div>
    <div class="cap-right"></div>
  </div>
</div>


<script>
 function getValue() {
     var valcmbColumn = document.getElementById("cmbColumn").value;
     var valcmbSidebar = document.getElementById("cmbSidebar").value;

    valOutput = "label:"+valcmbColumn+"|label:"+ valcmbSidebar;
    window.open("http://urstrulyvijay.blogspot.in//search/?q=" + valOutput, "_self");
  }
</script>
&#13;
&#13;
&#13;

我已在我的Jquery editable select中实施blog我的问题是我要移除空格http://urstrulyvijay.blogspot.in/search/?q=label:apple%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20|label:mango

我的意思是实际的一个在下方并看到this图片以了解问题清楚

http://urstrulyvijay.blogspot.in/search/?q=label:apple|label:mango

我已经知道这个空间问题是由于文字和垂直条,如果我没有错。 image

2 个答案:

答案 0 :(得分:1)

使用trim()删除任何空格

valOutput = "label:"+valcmbColumn.trim()+"|label:"+ valcmbSidebar.trim();

答案 1 :(得分:0)

您的选项值后面只有空格。此外,不关闭option代码可能会有问题。

你应该改变这个:

<option value="apple+" />apple

对此:

<option value="apple+">apple</option>