通过 Jquery 从单击的锚标记填充标题上的隐藏表单元素值
嘿大家。我试图根据单击的链接在隐藏表单元素上设置一个值。我认为解决此问题的最佳方法是将锚标题属性作为特定隐藏表单元素的值传递。此隐藏表单元素值需要根据单击的最新链接进行更新。我在谷歌上搜索了 jQuery 片段来实现这一点,但似乎找不到一个很好的起点来运行它。
任何帮助表示赞赏!我正在学习,学习。
Hey all. I'm trying to set a value on a hidden form element based on a link that is clicked. I figure the best way to go about this is to pass along the anchor title attribute as the value for a particular hidden form element. This hidden form element value will need to be updated depending on the latest link that is clicked. I've scoured google for jQuery snippets to achieve this but can't seem to find a good starting point to run with this.
Any help is appreciated! I'm learning, learning.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果没有任何 HTML,它只是猜测,但一般方法是:
这会将
click
处理程序绑定到任何链接(当然您应该以某种方式限制此设置)并将其放在title< /code> 属性插入隐藏字段(由 ID 引用)。
参考:
click()
,val()
,attr()
, <代码>preventDefault()Without any HTML, it is just guessing, but a general approach would be:
This binds a
click
handler to any link (of course you should restrict this set somehow) and puts their thetitle
attribute into a hidden field (that is referenced by an ID).Reference:
click()
,val()
,attr()
,preventDefault()
请尝试这个:
HTH
Please try this:
HTH