how to Clear the values of Telerik Masked TextBox Via Jquery when users clicks on that Telerik Masked TextBox

StackOverflow https://stackoverflow.com/questions/18266499

Frage

I am making a module in which the person's name and mobile number is saved in the database. The Telerik Masked TextBox is being used as a method to get input phone numbers.

$(".mainContainer").find("#salebyowner").find("input").val("");

when that div gets loaded at first instance it respectively clears all the values on it. But when i click on that respective phone number's textbox, the values are then again set. I need to clear it. I have applied the following but it doesn't seems to be working.

 $(".mainContainer").find("#salebyowner").find("#rad_sale_owner_no").click(function () {                            $(".mainContainer").find("#salebyowner").find("#rad_sale_owner_no").val("");
 alert("its working");
 });

or if there is someother way by changing its properties, then that answer is also welcome.

War es hilfreich?

Lösung

Try this... it will work.

<ClientEvents OnFocus="onfocus" />

JavaScript:

<script type="text/javascript">
    function onfocus(sender, args) {
        sender.clear();
    }
</script>

Andere Tipps

Please try with the below code snippet.

JS

function myclick() {
            var txt = $find("<%= RadMaskedTextBox1.ClientID %>");
            txt.set_value('');
            return false;
}

ASPX

<telerik:RadMaskedTextBox ID="RadMaskedTextBox1" runat="server" Mask="(###) ###-####-####">
</telerik:RadMaskedTextBox>
<asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="return myclick();" />

Please use "set_value()" to clear/set the value.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top