How to Compare the Textbox Client id in JavaScript?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • varunkumarid
    New Member
    • Aug 2008
    • 40

    How to Compare the Textbox Client id in JavaScript?

    Hi to All,

    I want to Compare the Two Textbox ClientId not a Value of them, whether clientid is equal i perform something oterwise not.

    Code:
    for (var i = 2; i <= document.getElementById('ctl00_cphMaster_grdPaymentAmount').rows.length - 1; i++) {
    if(document.getElementById('ctl00_chMaster_ctl04_txtPayAmount') == document.getElementById('ctl00_chMaster_ctl0' + i +'_txtPayAmount'))
    alert("Some");
    }
    because the i bind the textbox into gridview, so the value of the textbox is entirely different to previous value.

    but the if statement match all loop increment.

    How can i do this?

    Please Help me.

    Thanks a lot.
    Last edited by Niheel; Jul 7 '10, 03:26 PM. Reason: Please use code tags to display code
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    I'm not quite sure if I'm following, but if you want to match the client ID, surely you'd just check if i equals 4?

    Comment

    Working...