General Question

stephen's avatar

Is there some one know this javascript plugin?

Asked by stephen (351points) April 24th, 2008

http://digitalbush.com/projects/masked-input-plugin

its really cool ! but i don’t know how to use it. could anybody tell me please !!

Observing members: 0 Composing members: 0

6 Answers

Breefield's avatar

Well, do you know javascript / html?

stephen's avatar

@breefield, yep,but its the first time to use plugin, can you tell me how to use that? deeply appreciate !!!

frankielaguna's avatar

Well I haven’t used it, but from reading their usage doc:

Assign an ID to your text field: <input type=“text” id=“NAME_OF_ID” />
Add: <script src=“jquery.maskedinput.js” type=“text/javascript”></script> To the <head> section of your page..

Then also add,

jQuery(function($){
$(”NAME_OF_ID”).mask(“99/99/9999”);
});

The 99/99/9999 is the format of what you want your string to be.

And that’s about that. I’m not sure what else to say, the Usage page really explains how to do it all.

Hope this helps.

stephen's avatar

@frankielaguna,thanx but that doesnt work follow your explaining, maybe at least these codes
jQuery(function($){
$(”NAME_OF_ID”).mask(“99/99/9999”);
});
should be placed into
window.onload=function(){
}
but it still doesnt work!

this is my code:
———————————————index.html—————————
<html>
<head>
<script src=“jquery.maskedinput.js” type=“text/javascript”></script>
<script type=“text/javascript”>
window.onload=function(){
jQuery(function($){
$(“date”).mask(“99/99/9999”);
});
}
</script>

</head>
<body>
<input type=“text” id=“date”/>
</body>
</html>

and i placed “jquery.maskedinput.js.js” into the same file with index.html

frankielaguna's avatar

Alright I know exactly what you’re missing/doing wrong.

You need 3 files, The three I am using in my example are:
test.html
jquery.js
maskedinput.js

Explanation of each:

Test.html – is our HTML page that holds the code needed to call the javascript.
jQuery.js – is the jQuery library, which the Masked Input Library is based off of (You Are Missing This Library)
maskedinput.js – Is the Masked Input library

My Code For test.html is:

<!DOCTYPE html PUBLIC ”-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
<html xmlns=“http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=“Content-Type” content=“text/html; charset=iso-8859–1” />
<title>JQuery test</title>
<script src=“jquery.js” type=“text/javascript”></script>
<script src=“input.js” type=“text/javascript”></script>
<script type=“text/javascript”>
jQuery(function($){
$(”#date”).mask(“99/99/9999”);
});
</script>
</head>
<body>
<form action=”” method=“post”>
<p><label>Date:</label><input type=“text” id=“date” name=“date” /></p>
</form>
</body>
</html>

————————————-

You need to call the jQuery library first then call the masked input library.
This is a requirement because you can not run masked input, without jQuery.

What I had noticed is that you do not have the jQuery library included on the page. If you do not have the library you can get it from the jQuery Website

Let me know if you have anymore questions.

stephen's avatar

@frankielaguna,thanx very much, how can i even forgot “jQuery”! _#. it works now, thanx again!!

Answer this question

Login

or

Join

to answer.

This question is in the General Section. Responses must be helpful and on-topic.

Your answer will be saved while you login or join.

Have a question? Ask Fluther!

What do you know more about?
or
Knowledge Networking @ Fluther