【问题标题】:Setting the output onclick for a form为表单设置输出 onclick
【发布时间】:2015-06-22 12:57:05
【问题描述】:

这是我写的

<form method="post" id="create">
  <div class="panel panel-success">
    <div class="panel-heading">
      <p>Create a new Wall Post</p>
    </div>
    <div class="panel-body">
      <textarea cols="80" id="text" name="text" rows="10" style="visibility: hidden; display: none;"></textarea>

      <script>
        $('#text').wysibb(options);
      </script>

      <div class="pull-right">
        <br>
        <button onclick="$('#text').val($('#text').htmlcode())" type="submit" name="create" class="btn btn-success">Post</button>
        <button type="reset" name="reset" class="btn btn-danger">Reset</button>
      </div>
    </div>
  </div>
</form>


  <?php
  if (isset($_REQUEST['create'])) {
      $p = WallPostManager::createWallPost($user, UserManager::isLoggedIn(), $_POST['text']);

      if ($p != false) {
          Utils::alert("News Post created", false);
          header('refresh: 1');
      }
  }

但由于某种原因,当我将其指定为 .htmlcode() 时,我在 bbcode 中获取了“文本”,会发生什么情况?我做错了吗?

【问题讨论】:

  • htmlcode() 不是 jQuery 函数...你能澄清一下你想用那个 onclick 代码完成什么吗?
  • @nthall .htmlcode() 是他正在使用的插件中的一个函数:wysibb.com/docs/p9.html

标签: javascript php html web


【解决方案1】:
$('#text').htmlcode()

正如@nthall 所提到的,这不是一个 jQuery 函数,因此不起作用。尝试将其更改为

$('#text').html()

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2010-10-08
  • 2016-10-11
  • 1970-01-01
  • 1970-01-01
  • 2011-12-16
  • 2023-03-23
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多