Right now spectrum gets called for the input box showInputAndInitial through docs.js function that is labled $("#showInputAndInitial").spectrum()
my question is can I use just the one function in docs.js or do I need to make a new function entry for every single input box, My page will have somewhere around 25 input boxes, so I was hoping there was a more efficient method than just making a ton of entries in docs.js (anyway to not use the id name to call the function?):
$("#showInputAndInitial").spectrum()
$("#showInputAndInitial2").spectrum()
$("#showInputAndInitial3").spectrum()
......
example of php page:
Code:
<link rel="stylesheet" type="text/css" href="css/default.css">
<link rel="stylesheet" type="text/css" href="css/spectrum.css">
<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
<script type="text/javascript" src="js/spectrum.js"></script>
<script type='text/javascript' src='js/docs.js'></script>
<input type='text' name='showInputAndInitial' id='showInputAndInitial' value='daa520' />
<input type='text' name='showInputAndInitial2' id='showInputAndInitial2' value='daa520' />
<input type='text' name='showInputAndInitial3' id='showInputAndInitial3' value='daa520' />
<input type='text' name='showInputAndInitial4' id='showInputAndInitial4' value='daa520' />
<input type='text' name='showInputAndInitial5' id='showInputAndInitial5' value='daa520' />
docs.js:
Code:
$(function() {
$("#showInputAndInitial").spectrum({
preferredFormat: "hex",
showPalette: true,
showSelectionPalette: true,
palette: [ ],
localStorageKey: "jitest.homepage", // Any Spectrum with same string will share
showInitial: true,
showInput: true
});
});