|
i am having a text box and a button.i want to validate that textbox using javascript.when i click on the submit button one alert message will come that textbox must be filled out and if i am entering some value to that textbox it will show what value i have entered in that alert message.i want a sample code for this.
|
|
|
|
|
Try This
<script type="text/javascript">
function jsTest()
{
if (document.getElementById("<%=txtBox1.ClientID%>").value == "") {
alert("Please Select a Pay From Option");
document.getElementById("<%=txtBox1.ClientID%>").focus();
return false;
}
else {
alert(document.getElementById("<%=txtBox1.ClientID%>").value);
}
}
</script>
|
|
|
|
|
It's as easy as drink water call below function
<script type="text/javascript">
function Confirm() {
return confirm("Are U sure to delete this file؟");
}
<asp:Button ID="BtnDelete" runat="server" Text="delete" Width="95" OnClientClick="if (!Confirm()) return false;" UseSubmitBehavior="False"/>
|
|
|
|