javascript - JS - Color Picker Only first one works -
i using bootstrap colorpicker 2.1 in order display 2 colour pickers in form. works fine using 1 input however, when add second 1 first 1 working. maybe because sharing same class…
any idea why happening?
<form method="post"> <p><?php _e("box 1: " ); ?> <input class="form-control demo" data-horizontal="true" id="demo_forceformat" placeholder="<?php echo $box1?>" type="text" name="box1" value="<?php echo $box1?>" size="20"> <?php _e(" default: rgba(14,112,209,1)" ); ?></p> <p><?php _e("box 2 " ); ?> <input class="form-control demo" data-horizontal="true" id="demo_forceformat" placeholder="<?php echo $box2?>" type="text" name="box2" value="<?php echo $box2?>" size="20"> <?php _e(" default: rgba(144,112,209,1)" ); ?></p>
it related sharing same id.
ids should unique each element on page.
change id="demo_forceformat"
id="demo_forceformat2"
, or better, have same values id property name property. common convention use same id , name values form elements.
Comments
Post a Comment