Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder Arcticwarrio's Avatar
    Join Date
    May 2012
    Location
    UK
    Posts
    876
    Thanks
    24
    Thanked 100 Times in 100 Posts

    problem with jquery

    in PHP i have

    PHP Code:
    for ($i=1$i<=10$i++){
         
    $Content3 .= ' <tr>
            <td><div align="center">
              <input name="Code['
    .$i.']" type="text" id="Code" size="10" />
            </div></td>
            <td><div align="center">
              <input name="Description['
    .$i.']" type="text" id="Description'.$i.'" size="50" />
            </div></td>
            <td><div align="center">
              <input name="Qty['
    .$i.']" type="text" onblur="currency(LinePrice'.$i.',1,LinePrice'.$i.',Qty'.$i.',Price'.$i.')" id="Qty'.$i.'" size="8" />
            </div></td>
            <td><div align="center">
              <input name="Price['
    .$i.']" type="text" onchange="currency(this)" onblur="currency(LinePrice'.$i.',1,LinePrice'.$i.',Qty'.$i.',Price'.$i.')" id="Price'.$i.'" size="15" value="0.00" />
            </div></td>
            <td><div align="center">
              <input name="VAT['
    .$i.']" type="text" id="VAT'.$i.'" size="8" />
            </div></td>
            <td><div align="center">
              <input name="LinePrice['
    .$i.']" autocomplete="off" type="text" value="0.00" id="LinePrice'.$i.'" size="15" />
            </div></td>
            </tr>'
    ;

    and in script.js i have

    Code:
    $(function(){
    
        $('#month').autocomplete(['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'], {
            width: 200,
            max: 3
        });
    
        $('#year').autocomplete('data.php?mode=xml', {
            width: 200,
            max: 5
        });
    
        $('#Customer').autocomplete('datac.php?mode=sql', {
            width: 200,
            max: 8
        });
    	
        $('#Code').autocomplete('datas.php?mode=sql', {
            width: 200,
            max: 5,
            return: false
        });
    
    
    });
    the fields Code only works on the first instance and i've tryed adding number or letters the the id's but none of them work

    where am i going wrong?
    There are 10 types of people on CodingForums,
    Those who understand Binary and those who dont.
    Get Cloud Hosting now from only£59 / month

  2. #2
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    use classes instead of ID's

  3. Users who have thanked DanInMa for this post:

    Arcticwarrio (03-13-2013)

  4. #3
    Regular Coder Arcticwarrio's Avatar
    Join Date
    May 2012
    Location
    UK
    Posts
    876
    Thanks
    24
    Thanked 100 Times in 100 Posts
    NVM i fixed it

    thanks Dan

    almost works,

    if i delete any of the codes fields 2 - 10 it also clears the 1st one

    any ideas?
    Last edited by Arcticwarrio; 03-13-2013 at 12:57 PM.
    There are 10 types of people on CodingForums,
    Those who understand Binary and those who dont.
    Get Cloud Hosting now from only£59 / month


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •