I need a help from you all. In my website, I am generating different colour shades from a selected color. Till here it works fine but after generating different shades, when I select a radio button associated with shades, I get value of first shade no matter how many random radio buttons I select
And the color hex value is coming from array... I want to get the value of selected radio button and store it into html5 localstorage. localstorage works fine if i enter simple text instead of selected radio button value. Please have a look
I am positing my code below:
function makeTableRowColors(colors, displayType)
{
var tableRow = "<tr>";
for (i = 0; i < colors.length; i++)
{
if (displayType == "colors")
{
tableRow += "<td style=\"background-color:" + "#" + colors[i].toString(16) + ";width:85px;height:75px;border-radius:5px;\";><input type='radio' class='ShadeRadioButtons' name='rsSelections' style='position:relative;top:-24px;' value='#"+colors[i].toString(16).toUpperCase()+"'></td>";
}
else
{
tableRow += "<td class=\"rgb-value\">#" + colors[i].toString(16).toUpperCase() + "</td>";
}
}
tableRow += "</tr>";
return tableRow;
}
You didn't post your HTML or the localStorage code you are attempting, but the code should make sure to get the value property, as in:
radButton.value
This code works for me: https://jsfiddle.net/10factxr/1/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.