Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

can't get jquery maskedinput to work

Status
Not open for further replies.

sharonchapman7

Programmer
Aug 31, 2011
45
US
Hi,
I have the following code in my html page. It works if I test it with alert but when I try to run as is I get the error: Microsoft jScript runtime error: Object doesn't support property or method 'mask'

<script src="Scripts/jquery-1.2.8.js" type="text/javascript"></script>
<script src="Scripts/jQuery.maskedinput.js" type="text/javascript"></script>

<script type="text/javascript">
jQuery(document).ready(function($) {
$("#txtCommercial").mask("(999) 999-9999");
});
</script>

Can someone please help me on this?

Thanks Sharon
 
Hi

It works for me, as you can see on jsFiddle.

There is probably some error elsewhere, so post your entire code. ( As appear on client side, in the browser. Preferably reduced to the minimum necessary which is still functional and exposes the problem. )

Feherke.
[link feherke.github.com/][/url]
 
I don't recall for how long the handler for ready() has had the jquery global object passed as an argument. As a suggestion try upgrading jquery to the latest version (now above 1.8) or removing the argument from the handler.

This assumes you have checked obvious things like the plugin being loaded properly and there actually being a text field with that id.
 
jpadie,
According to the jquery.com website, 1.8.2 is the latest version. Should I be downloading it from some where else?

Sharon
 
feherke,
Thank you for any help you can give me on this. Here is my code:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="default.aspx.vb" Inherits="_default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<html xmlns="<head id="Head1" runat="server">
<title>GDR Request Form</title>

<script src="Scripts/jquery-1.8.2.js" type="text/javascript"></script>
<script src="Scripts/jQuery.maskedinput.js" type="text/javascript"></script>

<script type="text/javascript">
jQuery(document).ready(function ($) {
$("#txtCommercial").mask("(999) 999-9999");
});
</script>
<link href="Styles/style2.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<table class="ftitle2">
<tr>
<td style="text-align:left" width="25px">
Commercial:</td>
<td>
<asp:TextBox ID="txtCommercial" runat="server" Width="110px" ToolTip="Please Enter:(999) 999-9999"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredCommercial" runat="server" SetFocusOnError="True" ErrorMessage="Mandatory!"
ControlToValidate="txtCommercial" ForeColor="Red" Font-Bold="True" Font-Underline="True" />
</td>
<td style="text-align:left" width="25px">
DSN:</td>
<td>
<asp:TextBox ID="txtDSN" runat="server" Width="110px" ToolTip="Please Enter: 999-9999"></asp:TextBox>
</td>
</tr>
</table>
<br />

<asp:Button ID="btnSave" runat="server" Text="Submit Request"
Font-Bold="True" />
</form>
</body>
</html>
 
Hi

Feherke said:
There is probably some error elsewhere, so post your entire code. ( As appear on client side, in the browser. Preferably reduced to the minimum necessary which is still functional and exposes the problem. )
That means no ASP, just HTML as displayed by your browser's Views page source command.

Feherke.
[link feherke.github.com/][/url]
 
but your code refers to jquery version 1.2.8
 
Sharon
Feherke is asking for you to paste the code that you would see if, in a browser, you right clicked and selected 'view source'.
 
I see what you mean. I have two laptops but only one of them is connected to the Internet. The laptop I'm working on isn't connected to the Internet. I will take it home tonight and connect it to the Internet. Then I can send you the code. I work for the government, what can I say.

Sharon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top