Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

javascript regx in getelementbyid ??

Options
  • 18-03-2010 7:11pm
    #1
    Closed Accounts Posts: 4


    i have a span which contains as in hidden field

    <span name="pc_fields" id="profit_center<%=pc.id%>_span">
    <%= hidden_field_tag "profit_centers[#{pc.id}]", pc.send(percent_field) %>
    <%= hidden_field_tag "profit_centers_#{pc.id}_locked", 1 %>
    </span>

    and this span is in a table row so there will be more than one span

    now i have in javascript i have like
    var all_pcs = document.getElementsByName('pc_fields') this wont work in IE .

    so i want to write some thing like this
    var all_pcs = document.getElementByid('profit_center'*'_span').

    thanks in advance for you help.


Comments

  • Registered Users Posts: 339 ✭✭duffman85


    mayur wrote: »
    i have a span which contains as in hidden field

    <span name="pc_fields" id="profit_center<%=pc.id%>_span">
    <%= hidden_field_tag "profit_centers[#{pc.id}]", pc.send(percent_field) %>
    <%= hidden_field_tag "profit_centers_#{pc.id}_locked", 1 %>
    </span>

    :confused: you haven't explained what you're trying to do with the <span> elements

    document.getElementsByName example at W3Schools.com works for me in IE8 and in IE8 compatibility view.


  • Closed Accounts Posts: 4 mayur


    once i get the elements i can loop through them and do lot of things. i am sure we can use regex or some thing to do this, but not sure how yet . thanks for your replay.


Advertisement