Skip to content

Commit

Permalink
Merge pull request #5 from hrjha97/harsh
Browse files Browse the repository at this point in the history
update script.js
  • Loading branch information
apurvjha123 authored Jan 9, 2024
2 parents 678ebfc + 9f85003 commit 9c39e3f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,17 @@ function generateFormFields(config) {
<label>${field.label}:</label>
<input type="${field.type}" src="${field.src}" alt="${field.alt}" />
`;
} else {
}
else if (field.type === 'color' || field.type === 'range') {
// Handle color and range fields separately
return `
<label>${field.label}:</label>
<input type="${field.type}" id="${field.name}" name="${field.name}" ${
field.type === 'range' ? 'min="0" max="100"' : ''} ${
field.type === 'color' ? 'value="#000000"' : ''} />
`;
}
else {
return `
<label for="${field.name}">${field.placeholder}:</label>
<input type="${field.type}" id="${field.name}" name="${field.name}" placeholder="${field.placeholder}" required />
Expand Down

0 comments on commit 9c39e3f

Please sign in to comment.