Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9077913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T19:29:31+00:00 2026-06-16T19:29:31+00:00

Here is my javascript: $(document).ready(function(){ $(.reply).click(function(){ var replyId = $(this).attr(id); $(textarea[name=’comment’]).val(<reply:+replyId+>); $(textarea[name=’comment’]).ready(function(){ moveCursorToEnd($(this)); });

  • 0

Here is my javascript:

$(document).ready(function(){
    $(".reply").click(function(){
        var replyId = $(this).attr("id");
        $("textarea[name='comment']").val("<reply:"+replyId+">");
        $("textarea[name='comment']").ready(function(){
            moveCursorToEnd($(this));
        });
    });
});

function moveCursorToEnd(el) {
    if (typeof el.selectionStart == "number") {
        el.selectionStart = el.selectionEnd = el.value.length;
    } else if (typeof el.createTextRange != "undefined") {
        el.focus();
        var range = el.createTextRange();
        range.collapse(false);
        range.select();
    }
}

I am somewhat new to functions with javascript however this does not seem to work It will put the value in but not focus to the textarea. I am sure I am doing something very dumb, any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T19:29:32+00:00Added an answer on June 16, 2026 at 7:29 pm

    The ready event for the textarea will not fire because once the event is attached the textarea has already been loaded. Also you must also pass the raw element, not the jQuery object into the function. Try to changing these lines

    $("textarea[name='comment']").ready(function(){
        moveCursorToEnd($(this));
    });
    

    to this

    moveCursorToEnd($("textarea[name='comment']")[0]);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is function , <script type=text/javascript> $(document).ready(function() { getRecordspage(1, 5); $(a.page-numbers).click(function() { alert(1); getRecordspage($(this).text(),
Update: I did get this working, here is the new javascript: $(document).ready(function() { $('a').click(
Here is my script: <script type=text/javascript> $(document).ready(function () { $(.div_question).toggle(function () { var answer=
Here is the JavaScript: $(document).ready(function(){ //set location of san antonio var san_antonio = new
Here is my Javascript formvalidator function: function companyName() { var companyName = document.forms[SRinfo][companyName].value; if
Here is my Javascript... <script type=text/javascript> function validator() { var x = parseInt(document.MyForm.textnuming.value); alert(x);
I have a dropdown issue on my navigation pane. Here is my javascript: $(document).ready(function
Here is the JavaScript function ChangeVol(id) { document.form.selectFS_devId.value = id; document.form.selectFS_currentNameSpace.value = ; document.form.submit();
Total noob here with javascript. I'm trying to alter a function. This is the
Using the javascript: $(document).ready(function() { $(.fancybox).fancybox({ helpers: { overlay: { opacity: 0.4, css: {

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.