Jump to content

Adding a string to a textbox


Truly

Recommended Posts

Hi guys, really stupid question for you.I am validating a textbox, making sure that no one has '.' or '/' in it. If its true that neither of those characters exist then I want it to add '.php' to the end but I cant remember how. Im thinking it would be something like this:document.formname.textboxname=.documnent.formname.textboxname+".php"Im more of a php guy myself so any help would be appreciated :).

Link to comment
Share on other sites

I would recommend adding the id attribute to your form elements (ie <input type="text" name="txtField" id="txtField"/>)Then you can do this

var txt = document.getElementById("txtField");txt.value = txt.value + ".php";

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...