-1

I've made a subscription form with a category dropdown select field. The text value of the selected option has to display 4 times in the form. It's 1 form.

<select name="catid" onchange="copy()" id="catid" class="inputbox required">
  <option value="" >Selecteer Categorie&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</option>
  <option value="62" >Huurwoning</option>
  <option value="58" >Kamerhuur</option>
  <option text="kamerhuur" value="59" >Parkeren</option>
  <option value="60" >Vakantiewoning</option>
  <option value="61" >Bedrijfsruimte</option>
</select>

Do you have suggestions?

4

1 回答 1

1

这将在更改时获得所选选项的文本

 $('#catid').on('change', function() {
   /* get text of selected option*/
   var txt=$(this).find('option:selected').text();
   /*  change text of elements*/
   $('#elem1, #elem2 ....').text(txt); 
});

没有任何 html 样本很难知道你需要什么来插入文本

于 2013-11-10T23:23:17.360 回答