Click here to Skip to main content
15,908,901 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hi,
I am new to jquery concept, in aspx page to edit and cancel i had used concept of jquery wherein the functionality works fine .this concept of edit and delete once the student had updated the profile..... but first time when he is entered to the page only textboxs should be there .pls provide a solution for it.

jquery:
$(document).ready(function () {
$("#EditFirstName").click(function () {
$(".ClassFirstName").toggle("blind");
$("#txtFirstName").val($("#lblFirstName").text());
});
$("#CancelFirstName").click(function () {
$(".ClassFirstName").toggle("blind");
$("#txtFirstName").val("");
});

});

apsx page:

XML
<div style="margin: 10px">
                                <label>FirstName:</label>
                                <asp:Label ID="lblFirstName" ClientIDMode="Static" runat="server" Class="ClassFirstName"></asp:Label>
                                <asp:TextBox ID="txtFirstName" ClientIDMode="Static" Class="ClassFirstName" runat="server" MaxLength="20" Style="display: none;"></asp:TextBox>
                                <a href="#" class="ClassFirstName" id="EditFirstName">Edit</a><span>&nbsp;</span>
                                <a href="#" class="ClassFirstName" id="CancelFirstName" style="display: none">Cancel</a><span>&nbsp;</span>

                            </div>



my problem is on page load i want the textbox to be visibled ? pls do find the solution for me.
Posted
Comments
Sayan Bera 6-Dec-13 11:43am    
Why are you using "style="display: none;" for the textbox?

Take Style="display: none;" off of the textbox. Then in jquery you can do
JavaScript
$("#txtFirstName").show();
and 
$("#txtFirstName").hide();
 
Share this answer
 
Comments
Member 10028392 6-Dec-13 12:28pm    
thankyou sir.
Visibility is visibility, can be controlled by jQuery .hide()/.show():
http://api.jquery.com/hide[^],
http://api.jquery.com/show[^].

See also the proper use of .toggle(); it is applied to a matching element (object on which you call the method), and the parameters are used to specify duration of the effect and, optionally, the animation:
http://api.jquery.com/toggle/[^].

So, I have no idea what you meant by "blind". :-)

—SA
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900