Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Select() method unsupported in Safari



I would like to select the text in a text field to
highlight it and so that it will be replaced when the
user begins typing.  According to most textbooks, the
select() method in Javascript is the way to do this. 
However it seems that the select() method is not
supported by Safari.  Does anyone know why?  Can
anyone suggest a workaround?


The following code works in every web browser I've
tested except Safari:


<!--

<html>
<head>

<script type="text/javascript">
    function selectText()
    {
        document.getElementById("textField").select();
    }
</script>

</head>

<body>

    <form>
        <input size="40" type="text" id="textField"
value="The cat is on the mat">
        <input type="button" value="Select text"
onclick="selectText()">
    </form>

</body>
</html>

-->


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Web-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/web-dev/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.