How to set value to asp:textbox, added to the form as HTML?

rss

Posted by Дмитрий Фоломеев - Nov 26 ’14 at 11:16

How to set value to asp:textbox (not sharepoint field), added to the form as HTML?

 

For example, I added asp:TextBox (as HTML) to form:

<asp:TextBox runat="server" id="TextBox100" ></asp:TextBox>

 

I want to set the field value, and do other changes using javascript:

fd.field('TextBox100').value('100');- not work

document.getElementById('TextBox100').value= "100"; - not work


please help.

  • Dmitry Kozlov
    Dmitry Kozlov
    Admin
    Member for: 6 years 2 months 22 days
    #1 by Dmitry Kozlov Nov 27 ’14 at 09:52

    Hi Dmitry,

    You can assign a CSS class to the textbox:

    <asp:TextBox runat="server" id="TextBox100" CssClass="my-textbox" ></asp:TextBox>

    And use it in your JS-code following way:

    $('.my-textbox').val()
  • Дмитрий Фоломеев
    Дмитрий Фоломеев
    Member
    Member for: 5 years 15 days
    #2 by Дмитрий Фоломеев Nov 27 ’14 at 10:31

    [#1]:        
    Thank you, it works!

Displaying 1 to 2 of 2 messages