Is there a way to utilize JavaScript code to automatically insert a specific word into a TextBox
when an ImageButton
is clicked? The TextBox
may already contain some text before the desired word is inserted. Although I have successfully implemented this in VB.NET, I am interested in achieving it on the client side using JavaScript. Can anyone provide guidance as to how this can be accomplished? (I am new to JavaScript)
Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click
Dim smileyFace As String = TextBox2.Text & ":)"
ScriptManager.RegisterStartupScript(Me.Page, Me.Page.[GetType](), "myScript", "document.getElementById('" + TextBox2.ClientID & "').value = ' " & smileyFace & "';", True)
SetFocus(TextBox2)
End Sub