You need to enable JavaScript to run this app. 使用Tailblocks CTA区块代码添加form后点击按钮无法跳转页面问题咨询
优惠活动
大模型
产品
解决方案
定价
更多

使用Tailblocks CTA区块代码添加form后点击按钮无法跳转页面问题咨询

点击按钮无法跳转的原因与修正方案

核心问题定位

  • 拼写错误导致表单提交属性完全失效:自行添加的<form>开标签中,把提交地址属性action错写为ction,浏览器无法识别这个无效属性,找不到提交完成后的目标跳转地址,就会出现点击按钮无响应的问题。
  • 细节说明:表单内的<button>元素如果不手动指定type属性,默认行为是type="submit",本身可以触发表单提交跳转,本次的问题根源完全来自上述的属性拼写疏漏。

修正后的可用代码

<form action="index.php" method="post">
  <section class="text-gray-600 body-font">
    <div class="container px-5 py-24 mx-auto flex flex-wrap items-center">
      <div class="lg:w-3/5 md:w-1/2 md:pr-16 lg:pr-0 pr-0">
        <h1 class="title-font font-medium text-3xl text-gray-900">Slow-carb next level shoindcgoitch ethical authentic, poko scenester</h1>
        <p class="leading-relaxed mt-4">Poke slow-carb mixtape knausgaard, typewriter street art gentrify hammock starladder roathse. Craies vegan tousled etsy austin.</p>
      </div>
      <div class="lg:w-2/6 md:w-1/2 bg-gray-100 rounded-lg p-8 flex flex-col md:ml-auto w-full mt-10 md:mt-0">
        <h2 class="text-gray-900 text-lg font-medium title-font mb-5">Sign Up</h2>
        <div class="relative mb-4">
          <label for="full-name" class="leading-7 text-sm text-gray-600">Full Name</label>
          <input type="text" id="full-name" name="full-name" class="w-full bg-white rounded border border-gray-300 focus:border-indigo-500 focus:ring-2 focus:ring-indigo-200 text-base outline-none text-gray-700 py-1 px-3 leading-8 transition-colors duration-200 ease-in-out">
        </div>
        <div class="relative mb-4">
          <label for="email" class="leading-7 text-sm text-gray-600">Email</label>
          <input type="email" id="email" name="email" class="w-full bg-white rounded border border-gray-300 focus:border-indigo-500 focus:ring-2 focus:ring-indigo-200 text-base outline-none text-gray-700 py-1 px-3 leading-8 transition-colors duration-200 ease-in-out">
        </div>
        <button type="submit" class="text-white bg-indigo-500 border-0 py-2 px-8 focus:outline-none hover:bg-indigo-600 rounded text-lg">Button</button>
        <p class="text-xs text-gray-500 mt-3">Literally you probably haven't heard of them jean shorts.</p>
      </div>
    </div>
  </section>
</form>

后续排查提示

  • 可以在浏览器开发者工具的元素面板中,检查form标签的属性是否被正确识别,避免同类拼写疏漏
  • 给按钮显式补充type="submit"属性后,可以规避不同浏览器下对按钮默认类型判定的差异,保证提交行为稳定

内容的提问来源于stack exchange,提问作者Robin Johnson

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.30 19:24:02