-2

I want to target more than one input through for.

something like

<label for="web-category,three-hundred-dollar" >Web design - $300</label>

<input name="category" type="radio" id="web-category" value="Web Design" class="hidden">
<input name="pkg"      type="radio" id="three-hundred-dollar" value="$300" class="hidden">

IS this possible or any work around ?

Please provide any solution that revolves around this rather than going through back end and find pkg, or api or whatever like that

  • 1
    Your question is not clear, at least I can't understand what you're asking. When you say you want to "target more than one input".. with what? – cody Dec 11 '18 at 17:39
  • You could probably do this with JavaScript, but what's the goal of focusing two different radio buttons? – j08691 Dec 11 '18 at 17:39
  • There are two different input with two different name and two different values that will be sent to the server when form submit – Simon Anaxdesigns Dec 11 '18 at 17:42
  • @cody Ok I hope all this typing worth it. If I click on this label and it has id of only one input then it will focus it and if it is checkbox or radio then it will check it too. What I am trying to do is when I click this label it checks both category and pkg radion with ids web-category and three-hundred-dollar. SOmething I can do easily with JS but I am hesitant as I need to be sure there is no easy way around. – Simon Anaxdesigns Dec 11 '18 at 17:58

3 Answers3

1

You can have only one label per input. When you connect label and input like that click event on label will send focus to input. Since you cannot have focus on two elements at the same time it is unlikely that you can do such thing.

0

You can not give more than one id to attribute in html, but you can get the same by putting multiple class values into one attribute.... for multiple class go to HERE....

Darshan Rathod
  • 591
  • 4
  • 16
0

There is no point in having multiple id. id is specifically used to specify only one item. If you need to specify multiple items, use class. To display multiple classes, use:

class="class1 class2 class3"

Class items are seperated with spaces.