Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select text on entry
Message
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Client-side développement
Titre:
Select text on entry
Versions des environnements
Environment:
C# 4.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01555102
Message ID:
01555102
Vues:
64
Hi everybody,

I found online this JavaScript snippet to highlight input elements when they get focus:
$(document).ready(function () {

    $("form div input").focus(function () {

        $("form div").each(function () {
            $(this).css("background-color", "white");
        });

        $(this).parent().css("background-color", "#F2FAED");
    });

});
But in addition to that, I'd like to select all current text in the textbox or multi-line editbox. How can I do that?

Also, a bit unrelated question - I see that we can not specify width for the div element (I see it highlighted and shown as violating HTML5 standards). Is where another way to specify that one control which is defined with this code
 <div id="Phone2">
        <div class="float-left">
            <div class="editor-label">
                @Html.LabelFor(model => model.Phone2)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.Phone2)
                @Html.ValidationMessageFor(model => model.Phone2)
            </div>
        </div>
        <div class="float-left">
            <div class="editor-label">
                @Html.LabelFor(model => model.Ext2)
            </div>
            <div class="editor-field">
                @Html.EditorFor(model => model.Ext2)
                @Html.ValidationMessageFor(model => model.Ext2)
            </div>
        </div>
    </div>
takes 75% of the div width and the Ext takes 25 % ? Using class float-left put them both side by side, which is the effect I want, but I also would like to make ext control smaller and phone bigger.
If it's not broken, fix it until it is.


My Blog
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform