Strange question, I know.and perhaps stranger coding, but.
I'm trying to trigger a function with a text link and it works, but with the function coded as is, the link has to be clicked twice. I'd like to keep the function coded starting with "function ajaxCreateStoryTitle() {" rather than "(document).ready(function() {" for code organization purposes, but using "function. causes the text link to have to be clicked twice to fully execute the function. All this has to do with a method I'm trying to organize a lot of code that's needed to create an ajax-driven, single-interface page. Anyway.here's the trigger link: <a id="createStoryTitleLink" class="link" onClick="fnCreateStoryTitle();">create title</a> Clicking that link fire this function: function fnCreateStoryTitle() { ajaxCreateStoryTitle(); } The function, "ajaxCreateStoryTitle();" starts like this: ------------------- function ajaxCreateStoryTitle() { $('#createStoryTitleLink').click(function() { titleValue = $(this).parent().parent().find('#createStoryTitleInput)val(); etc. ------------------ Because of this coding, I have to click the text link above twice; once to trigger the function and the second time to trigger the $('#createStoryTitleLink').click(function() { line. I need the "titleValue" line to obtain the value of the text input "#createStoryTitleInput". Perhaps there's a different way to get that value other than with the "click" function? There may be a better way to achieve code organization that what I'm doing, but it's just my way of evolving my coding style using jQuery and AJAX. Suggestions? Another way to code the function "ajaxCreateStoryTitle()" and still be able to reference the titleValue in the input "#createStoryTitleInput" ??? Thanks for taking time to read through this. Rick ---------------------------------------------------------------------------- ----------------------------------------------------------- "It has been my experience that most bad government is the result of too much government." - Thomas Jefferson