I have a couple of radio buttons, and when either one is clicked I need to control what the placeholder value of an input text field is, so basically the radio button decides what the placeholder text is.
I have got something else working when the radio button is clicked, but not sure how to do it for the placeholder text.
This is that
if ($("input[name='rdio']:checked").val() == 'resort')
genderValue= "resort"
Another bug is that when you click the second radio button, the first one moves to the left, then check the left one and the right one moves, very untidy and cant find any solution for it and have used every keyword possible in google.
Works really well thank you Paul, have you ever had a problem where 2 radio buttons together left and right, and when you click one of them the other moves, only slightly but its as if there an area around it when its selected so it then pushes the other over, and then same for the other when that is selected.
I’d need to see an example but I guess some browsers might add something extra in the checked state causing the difference. It’s more likely that your missing labels are also part of the problem as the white-space in between the text and checkbox may cause problems.
Make sure you have a label for the text and then set the labels and inputs to display:inline-block.
If you have a reduced example demonstrating your problem I’ll take another look.
The ‘data’ attribute is an attribute that you can attach ‘data’ to that you can use later or modify as required. You create your own name as in my example ‘hint’ and then you can store and access data that may be needed later on.
You can create any name (in lowercase) as long as it starts with ‘data-’. e.g. data-my-code=“this is my data”.
Morning Paul, well it maybe morning depending where you are.
I have put the page I’m working on on the live server, but its a bit all over the place at the mo.
The area I’m working on is the block down the page a bit where you will see the two radio buttons for ‘Resort’ or ‘Hotel’, and if you try the radio buttons you will see they move.
Like you say though maybe I haven’t done it correct with using labels,
That means when it is unchecked you will get no margins and hence the jump. Remove those styles or apply them to all radios regardless of checked or not.