in Education by
First I'll explain my senario: I have a page in which users login or register. The login control and the register textbox are in two different divs and I use jQuery to hide one and show another. Then in register div I have a ScriptManager and an UpdatePanel and inside it's content template I have my button called check, which checks that the given username is not already chosen. (I have it in there because I don't want a postback). Now I want to code this: When the button event check the username after it should call a jQuery function to show me the div in which all my other textboxes are contained. $(document).ready(function () { var ide = $("#reg"); var log = $("#login"); var reg = $("#register"); var regfull = $("#regfull"); reg.hide(); regfull.hide(); ide.click(function () { log.fadeOut().delay(1000); reg.show("slow"); }); function completereg() { regfull.show(); } }); This is my jQuery and I want to call the completereg(); from code behind button onclick event and my button is in UpdatePanel. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
First you need to move your function outside of the $(document).ready() block : $(document).ready(function () { var ide = $("#reg"); var log = $("#login"); var reg = $("#register"); var regfull = $("#regfull"); reg.hide(); regfull.hide(); ide.click(function () { log.fadeOut().delay(1000); reg.show("slow"); }); }); function completereg() { $("#regfull").show(); } Then add the following into the $(document).ready() block to listen for clicks and execute the completereg function : $(document).on('click','#idofbutton',function(event) { completereg(); }); What the on function does is listen for clicks on the target (document) and checks the id (#idofbutton) of the trigger and performs the funciton ... this works for elements not yet added to the DOM. Documentation for on() here The target, in this case document, should be a parent element of the trigger element - this should really be a containaing div.

Related questions

0 votes
    My question is a variant of the question here However, there are two differences: I don't know how ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    My question is a variant of the question here However, there are two differences: I don't know how ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 23, 2022 in Education by JackTerrance
0 votes
    I am using a framework, which returns invalid JSON String like: /* { "myobject" : "test"} */ ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 2, 2022 in Education by JackTerrance
0 votes
    I'm working on a DNN skin using Christoc's DNN templates and when I create a normal ASP.NET ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 26, 2022 in Education by JackTerrance
0 votes
    I have a POST request that passes data to my database when the form is submitted. Photo of what I ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 14, 2022 in Education by JackTerrance
0 votes
    I have a POST request that passes data to my database when the form is submitted. Photo of what I ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 13, 2022 in Education by JackTerrance
0 votes
    We are planning to use the jQuery library to augment our client side JavaScript needs. Are there any major ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 25, 2022 in Education by JackTerrance
0 votes
    I have a simple MVC3 Controller Action like this [HttpGet] [OutputCache(Duration = 1200,Location=System.Web. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 13, 2022 in Education by JackTerrance
0 votes
    When I use ajax call from a modal window, the request url seems not correct. I have a webserver ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    I am building a backoffice to a certain site, and here i need to delete the comments from the ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 9, 2022 in Education by JackTerrance
0 votes
    I am using jquery ajax get. SO when my form is submitted it then submits to a php file but the ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 7, 2022 in Education by JackTerrance
0 votes
    I am building a backoffice to a certain site, and here i need to delete the comments from the ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 7, 2022 in Education by JackTerrance
0 votes
    I am building a backoffice to a certain site, and here i need to delete the comments from the ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 5, 2022 in Education by JackTerrance
0 votes
    I am using jquery ajax get. SO when my form is submitted it then submits to a php file but the ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 5, 2022 in Education by JackTerrance
0 votes
    I am building a backoffice to a certain site, and here i need to delete the comments from the ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 5, 2022 in Education by JackTerrance
...