我想在点击时获取文本框的值作为参数
<input type="text" id="remark_mention" />
// 链接在这里点击
<a class="remark "href="javascript:void(0);"style="text-decoration:none;color:#d90000;" id="st_mention<?php echo strip_tags($row["pid"]); ?>" onClick="mention_or_remmove_remarks('<?php echo strip_tags($row["pid"]); ?>','st_mention');"> Mention</a>
我的 jquery 函数如下
function mention_or_remmove_remarks(mention_id, action){
var dataString = "mention_id=" + mention_id + "&action=mention_or_remmove_remarks";//ajax code here for post mention_update.php
}
我如何在链接 Onclick 事件中获取文本框的值
你可以得到它。
使用表单并获取它:
<form>
<input type="text" id="remark_mention" name="remark_mention_ID"/>
<input type="button" onclick="foo(this.form.remark_mention_ID.value)"/>
</form>
或者 :
<input type="text" id="remark_mention" />
并在您的 js 文件中:
var value = $('#remark_mention').val(); // value variable has your latest value
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句