Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.
Hi all, please see this major site announcement: https://www.boards.ie/discussion/2058427594/boards-ie-2026

javascript regx in getelementbyid ??

  • 18-03-2010 07: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, Registered Users 2 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
Advertisement