Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to take textbox value in javascript

How to take textbox value in javascript

Scheduled Pinned Locked Moved ASP.NET
javascriptsysadmintutorial
7 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kishorg1
    wrote on last edited by
    #1

    </C1WebGrid:C1TemplateColumn> <C1WebGrid:C1TemplateColumn HeaderText="Comments"> <ItemStyle HorizontalAlign="Center"></ItemStyle> <HeaderStyle HorizontalAlign="Center"></HeaderStyle> <ItemTemplate> <asp:TextBox runat="server" ID="txtComments" TextMode="SingleLine" Width="120px" /> </ItemTemplate> </C1WebGrid:C1TemplateColumn> i hve txtComments textbox....i want to access tht value in javascript how i will get tht value in javascript

    M S S 4 Replies Last reply
    0
    • K kishorg1

      </C1WebGrid:C1TemplateColumn> <C1WebGrid:C1TemplateColumn HeaderText="Comments"> <ItemStyle HorizontalAlign="Center"></ItemStyle> <HeaderStyle HorizontalAlign="Center"></HeaderStyle> <ItemTemplate> <asp:TextBox runat="server" ID="txtComments" TextMode="SingleLine" Width="120px" /> </ItemTemplate> </C1WebGrid:C1TemplateColumn> i hve txtComments textbox....i want to access tht value in javascript how i will get tht value in javascript

      M Offline
      M Offline
      Manas Bhardwaj
      wrote on last edited by
      #2

      var textValue = document.getElementById('txtComments').innerText;

      Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

      K 1 Reply Last reply
      0
      • M Manas Bhardwaj

        var textValue = document.getElementById('txtComments').innerText;

        Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

        K Offline
        K Offline
        kishorg1
        wrote on last edited by
        #3

        Microsoft JScript runtime error: Object required if i use like tht thn above error is coming nw

        1 Reply Last reply
        0
        • K kishorg1

          </C1WebGrid:C1TemplateColumn> <C1WebGrid:C1TemplateColumn HeaderText="Comments"> <ItemStyle HorizontalAlign="Center"></ItemStyle> <HeaderStyle HorizontalAlign="Center"></HeaderStyle> <ItemTemplate> <asp:TextBox runat="server" ID="txtComments" TextMode="SingleLine" Width="120px" /> </ItemTemplate> </C1WebGrid:C1TemplateColumn> i hve txtComments textbox....i want to access tht value in javascript how i will get tht value in javascript

          S Offline
          S Offline
          Shaik Haneef
          wrote on last edited by
          #4

          var textValue = document.getElementById('<%txtComments.ClientID%>').value;

          K 1 Reply Last reply
          0
          • S Shaik Haneef

            var textValue = document.getElementById('<%txtComments.ClientID%>').value;

            K Offline
            K Offline
            kishorg1
            wrote on last edited by
            #5

            hi shaik........thts not workin gives an error.... :( any another way?

            1 Reply Last reply
            0
            • K kishorg1

              </C1WebGrid:C1TemplateColumn> <C1WebGrid:C1TemplateColumn HeaderText="Comments"> <ItemStyle HorizontalAlign="Center"></ItemStyle> <HeaderStyle HorizontalAlign="Center"></HeaderStyle> <ItemTemplate> <asp:TextBox runat="server" ID="txtComments" TextMode="SingleLine" Width="120px" /> </ItemTemplate> </C1WebGrid:C1TemplateColumn> i hve txtComments textbox....i want to access tht value in javascript how i will get tht value in javascript

              S Offline
              S Offline
              Sandeep Akhare
              wrote on last edited by
              #6

              What are you using is it gridView ?

              Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... " Check My Blog

              1 Reply Last reply
              0
              • K kishorg1

                </C1WebGrid:C1TemplateColumn> <C1WebGrid:C1TemplateColumn HeaderText="Comments"> <ItemStyle HorizontalAlign="Center"></ItemStyle> <HeaderStyle HorizontalAlign="Center"></HeaderStyle> <ItemTemplate> <asp:TextBox runat="server" ID="txtComments" TextMode="SingleLine" Width="120px" /> </ItemTemplate> </C1WebGrid:C1TemplateColumn> i hve txtComments textbox....i want to access tht value in javascript how i will get tht value in javascript

                S Offline
                S Offline
                Shaik Haneef
                wrote on last edited by
                #7

                i forgot to add '=' symbol after '<%' take below like working var textValue = document.getElementById('<%=txtComments.ClientID%>').value; This is Example simple code to check, you take new page add the code after page directive run this page u will find the output . for futher help contact sk.haneef@gmail.com Untitled Page

                alert(document.getElementById('<%=txtComments.ClientID%>')); var textValue = document.getElementById('<%=txtComments.ClientID%>').value; alert(textValue);

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups