【问题标题】:How to make an icon behave like a submit button in following scenario?在以下情况下,如何使图标表现得像提交按钮?
【发布时间】:2014-11-22 05:13:50
【问题描述】:

我有以下 HTML 代码:

<form action="xyz.php" method="post" class="navbar-form pull-right">
  <input style="width: 115px;" type="text" placeholder="Enter the zip code"> <i class="icon-map-marker icon-black"></i>
</form>

现在你可以从上面的代码中看到这一行了:

<i class="icon-map-marker icon-black"></i>

此行旨在显示引导程序中的地图标记图标。现在我想要实现的是让这个图标像提交按钮一样。也就是说,当用户在文本字段中输入一些值,然后单击此地图标记图标后,表单应该会提交。

如何做到这一点?

提前致谢。

【问题讨论】:

标签: php html icons form-submit


【解决方案1】:

您可以使用图像按钮轻松完成此操作,然后您可以随意设置样式

<form action="xyz.php" method="post" class="navbar-form pull-right" id="formId">
<input type="image" src="your_image_location" alt="Submit Form" />
</form>

【讨论】:

    【解决方案2】:

    使用此代码

    <form action="xyz.php" method="post" class="navbar-form pull-right">
      <input style="width: 115px;" type="text" placeholder="Enter the zip code">
    <input type="submit" value="Submit"><i class="icon-map-marker icon-black"></i></input>
    </form>
    

    这个用于提交

    <input type="submit" value="Submit"><i class="icon-map-marker icon-black"></i></input>
    

    http://urbandoor.in/

    【讨论】:

    • 你能解释一下你的代码吗?你知道&lt;input&gt;标签从来没有关闭标签吗?
    • 很确定输入没有结束标签。 ;)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-12-20
    • 2013-12-11
    • 2016-08-29
    • 1970-01-01
    • 1970-01-01
    • 2011-12-04
    相关资源
    最近更新 更多