php和ajax动态创建了选择框onchange事件 [英] php and ajax dynamically created select box onchange event

查看:76
本文介绍了php和ajax动态创建了选择框onchange事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想基本上为产品提供一些信息,并让用户

输入制作此产品所需的材料


1.首页test.php

带产品代码并显示prodcut anme使用了

ajax以避免刷新页面这很好用

2.now i已经创建了一行

复选框|选择框|文本|文本|文本|文本|

其中在选择框中的值从表中获取此处我也使用了ajax为了获得m_name自动withput refreshi工作正常(onchange事件)

3.之后我给了一个添加行按钮,动态添加行

与之相同静态行我已添加

现在我想使用我用于静态选择框的相同功能,以避免在这里刷新如何在这里传递onchange事件

并在按下之后提交按钮创建的动态行消失

任何人都可以帮助我wot是wr ong with this


如何将动态元素值从行传递到php以及静态行值

我的代码如下

i want to basically take some information for the product and let the user
enter the the material required to make this product

1.first page test.php
which takes product code and displays prodcut anme have used
ajax to avoid refreshing of page this works fine
2.now i have created one row with
checkbox|select box|text|text|text|text|
where in the select box values are fetched from table here also i have used ajax for getting the m_name automatically withput refreshi works fine (onchange event)
3.after that i have given a add rows button on which rows are added dynamically
with the same like static row i have added
now i wantto use the same function i have used for static select box for avoiding refreshing here how do i pass the onchange event here
and after pressing submit button the dynamic rows created disappears
can anybody help me wot is wrong with this

how do i pass dynamic elements values from the rows to the php along with the static row values
my code is as follows

展开 | 选择 | Wrap | 行号

推荐答案

请使用代码标签,以便解决您的问题。


亲切问候,

Dmjpro。
Please use Code tags then it will be easy to Solve your Problem.

Kind regards,
Dmjpro.


Leena,欢迎来到TSDN!


您是否知道可以在代码标签中指定语言,例如[code = javascript] ... [/ code。](删除点)。
Leena, welcome to TSDN!

Did you know that you can specify languages in the code tags, e.g. [code=javascript]...[/code.] (remove the dot).


提供动态创建的元素ID。对于您的选择,在创建元素时添加onchange。
Give your dynamically created elements ids. For your select, add the onchange when you create the element.


这篇关于php和ajax动态创建了选择框onchange事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆