r/jquery • • Apr 29 '16

Does this plugin exist?

I have a tool that searches a particular website, parses the results, and displays them on the webpage. What I want is the ability for my users to click on a button by the name that is part of each result and for that name to be populated in a form field elsewhere on the page. Ideally it would be something that is depressed when you click it, remains depressed, but you could click it again and it would go back to before and the name would be removed from the field. Does this exist? And if so what is it called?

0 Upvotes

4 comments sorted by

2

u/[deleted] Apr 29 '16

It won't be a plugin, because that should be a fairly simple thing to add with just your typical javascript and/or jquery.

1

u/rydan Apr 30 '16

The updating the form element is simple but what about the button and keeping it depressed? I'm a backend developer that avoids frontend as much as possible so my knowledge in this area is very limited.

2

u/[deleted] Apr 30 '16

Don't use a button. Use a check box, or if you need only one button among many depressed at once, use a radio group.

Hint: Clicking labels for form elements activates/focuses that form element. Hide the check/radio, attach a label and style the label.

This is actually more a CSS solution. I could make a quick demo tomorrow but I'm busy tonight

0

u/[deleted] Apr 30 '16

[deleted]

2

u/Cintax Apr 30 '16

You might want to reread his request, because what you're describing is not what op is asking about.