0

Good Day All

i have a Jquery code defined like this

// Let's add it to textarea this time
        $(".cnt").focus(function()
        {
            // Check for the change
            if(this.value == this.defaultValue){
                this.select();
            }
        });

and i am creating a textbox on fly and after creating it i bind data to it and after that i want to attach a focus event if there a value "0" on it

If cnt.Text = "0" Then
            cnt.CssClass = "cnt"
        End If

but still when i select a textbox that has "0" it does not select the whole content of the textbox. i went through a breakpoint and it goes through this line

cnt.CssClass = "cnt"

Thanks

3
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by stbuchok
0

so is your question is that.

You have a textbox and you define value to it as that can be defaultly be set and if you focus in on the textbox and there is no value define to it should be highlight.Is this the question sir

0

This looks like a mix of VB.Net and jQuery, am I correct?


This code is only adding a class to cnt, it is not adding a focus event.

If cnt.Text = "0" Then
            cnt.CssClass = "cnt"
        End If

Please explain in greater detail what you are trying to achieve, don't just show code. You need a proper mix of both in order to get your point across.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.