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.
Without any HTML, it is just guessing, but a general approach would be:
This binds a
clickhandler to any link (of course you should restrict this set somehow) and puts their thetitleattribute into a hidden field (that is referenced by an ID).Reference:
click(),val(),attr(),preventDefault()