简体   繁体   English

我想在我的PHP页面的选择菜单中的选择选项上添加一些文本框。 这应该是动态的(没有展开页面)

[英]I want to add some textboxes on selecting option from select menu in my PHP Page. This should be Dynamically(without reloding page)

On changing options from select menu the no of text boxes should be changed without reloading the page. 从选择菜单更改选项时,应在不重新加载页面的情况下更改任何文本框。

 <select id="options">
   <option >Select</option>
    <option value="first_div">first_div</option>
     <option value="second_div">second_div</option>
      <option value="third_div">third_div</option>
       <option value="fourth_div">fourth_div</option>
        <option value="fifth_div">fifth_div</option>
 </select>

I used following Sample Jquery code. 我使用了以下示例Jquery代码。 on selecting any option it goes to display div. 选择任何选项时,它将显示div。 But i want that if i select another option the another div should appears and previous should be removed. 但是我希望,如果我选择另一个选项,则另一个div应该出现,并且以前的应该删除。

$(function() { var selector = { options : '#o1' } $('#options').bind('change', function() { var h = $(this).val(); if (h) { $(selector[$(this).attr('id')]).find('> o1').each(function() { $(this).toggle(h == $(this).data('select-value')) .attr('disabled', (h != $(this).data('select-value'))); }); $(selector[$(this).attr('id')]).find('option:visible').eq(0).attr('selected', true); $(selector[$(this).attr('id')]).show(); } }); });` $(function() { var selector = { options : '#o1' } $('#options').bind('change', function() { var h = $(this).val(); if (h) { $(selector[$(this).attr('id')]).find('> o1').each(function() { $(this).toggle(h == $(this).data('select-value')) .attr('disabled', (h != $(this).data('select-value'))); }); $(selector[$(this).attr('id')]).find('option:visible').eq(0).attr('selected', true); $(selector[$(this).attr('id')]).show(); } }); });`

Its working to me.. 它对我有用。

$(function() { var selector = { options : '#o1' } $('#options').bind('change', function() { var h = $(this).val(); if (h) { $(selector[$(this).attr('id')]).find('> o1').each(function() { $(this).toggle(h == $(this).data('select-value')) .attr('disabled', (h != $(this).data('select-value'))); }); $(selector[$(this).attr('id')]).find('option:visible').eq(0).attr('selected', true); $(selector[$(this).attr('id')]).show(); } $(function() { var selector = { options : '#o1' } $('#options').bind('change', function() { var h = $(this).val(); if (h) { $(selector[$(this).attr('id')]).find('> o1').each(function() { $(this).toggle(h == $(this).data('select-value')) .attr('disabled', (h != $(this).data('select-value'))); }); $(selector[$(this).attr('id')]).find('option:visible').eq(0).attr('selected', true); $(selector[$(this).attr('id')]).show(); }
}); });

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我想在不重新加载页面的情况下从数据库显示div中的数据。 我该怎么做? - I want to show my data in div from database without reloading the page. How I can do this? 如何在不重新加载页面的情况下重新加载 Thymeleaf 表? - How to reload Thymeleaf table without reloding page? 需要使用当前页面的页面标题动态选择菜单选项 - Need to dynamically select menu option using the page title of the current page 顶部菜单显示一个空白选项,将我重定向到未定义的页面。 我该如何解决? - Top menu showing a blank option which redirects me to an undefined page. How can I fix it? Slick slider 在重新加载页面后几秒钟后工作 - Slick slider working after some second after reloding page 我想从没有页面刷新的情况下提交我的联系人 - i want to submit my contact from without page refresh 从列表中选择某些内容后,我想关闭 select 菜单 - I want to close the select menu after selecting something from list 我想从dropdrown中选择一个值,该值应更改html页面和map页面中的列表 - I want to select a value from dropdrown which should change the listings in html page and the map page 如何在网页上显示功能的结果。 我想显示平均分数和字母等级。 我已经附上了我的代码。 - How do I display my result from a function on the web page. I want to display the average score and the letter grade. I have enclosed my code. 我希望{{dish.name}}显示在html页面中。 - I want {{dish.name}} to be displayed in an html page.
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM