2012-03-31 32 views
1

我正在一个配方网站上(这个问题几乎完成,除了这个问题)在一个配方页面上,我有配方服务输入字段和配方成分。将配方原料更改为服务更改

我的问题是,使用jQuery我要动态地改变配方成分,如果服务改变

我已经看到了类似的封闭的威胁,但它并没有帮助我 我确切的代码看起来像这样

  Serving: <input type="text" name="serving" class="serving" value="5"/> persons 

      <h3>ingredients</h3> 
      <ul class="ingredients"> 
      <li class="ingredient"> 
      <span class="amount">1</span> cups 
      <span class="name"><a href="http://www.mysite.com/ingredient/yogurt/">yogurt</a></span> 
      </li> 

      <li class="ingredient"> 
      <span class="amount">2</span> tbsp 
      <span class="name"><a href="http://www.mysite.com/ingredient/yogurt/">chillies</a></span> 
      </li> 

      <li class="ingredient"> 
      <span class="amount">3</span> pieces 
      <span class="name"><a href="http://www.mysite.com/ingredient/yogurt/">butter</a></span> 
      </li> 
      </ul> 

我将高度赞赏任何帮助,让我完成我的悬而未决的网站

问候

回答

-1
+0

谢谢你的货车,至少我有一个基地。唯一的问题,我可以认为是在计算。例如,如果服务2人,配料量为2个单位,1人配料应为1个单位,而显示0.4个单位。 – user1305063 2012-03-31 14:02:24

+0

的确,我在小提琴中硬编码了5的起始值。你将不得不调整。 – vansimke 2012-03-31 21:30:34

+0

我的意思是说,计算工作不正常 – user1305063 2012-04-01 10:16:52