how to set char limit in prompt box using javascript?

Recommended Answers

All 5 Replies

What do you mean by this, in more details?

Member Avatar for diafol

If you're talking about a js popup, then I don't think it's possible. However modal dialogs like jQueryUI popups, which may serve a similar purpose for you can be controlled as you can use a <input maxlength="20" ... />

BTW - if you want further info, post to the js forum, not php.

I have called following javascript function onclick

<script type="text/javascript">
        function getValue(){
           var retVal = prompt("Why you want to apply this job? : ", "write here");
           alert("You have entered : " +  retVal );
        }
    </script>

now how to set char limit in prompt box?

This cannot be done with the prompt() function, you shoul look towards the jQueryUI or something like that.

Member Avatar for diafol

Ok moving...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.