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 8842187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:53:54+00:00 2026-06-14T10:53:54+00:00

How can add value to the hidden input filed? In this case input is

  • 0

How can add value to the hidden input filed? In this case input is being created as variable, and latter on inserted into the DOM if needed. The code:

<script>
    var forma = $('form#mali_oglas'),
    pomoc = $('div[role=pomoc]'),
    div = $('.mali_oglas_pomoc'),
    input = forma.find('input, textarea'),
    code = forma.find('#code')
    time_input = '<input type="hidden" name="time" />',
    paid_input = '<input type="hidden" name="paid" value="1" />';

    $('textarea').autosize();

    input.on('click', function(e){
        var name = $(':input:focus').attr("name");
        pomoc.fadeOut('slow').promise().done( function(){
         div.find("[data-pomoc='" + name + "']").fadeIn('slow');
     });
    });


    code.on('focusout', function(){
        var url = '<?php echo base_url() ?>global_info/gi_get_payment_code',
        kod = $(this).val();
if ($('input[name=paid]').length != 1)
    {
        $.post(url, {code : kod}, function(data){
            console.log(kod);
            $('.mali_oglas_img_paid').slideDown('slow');
            code.next('.mali_oglas_greska').remove();
            code.after(time_input.val(data) + paid_input)
            .css({'border' : '1px solid rgba(34,139,34,.5)'});
        });
    };
    });

    code.ajaxError(function() {
  $(this).next('.mali_oglas_greska').remove();
  $(this).after('<p class=mali_oglas_greska>Uneti kod je pogresan.</p>').css({'border' : '1px solid rgba(255,0,0,.5)'});
});
</script>
  • 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-14T10:53:55+00:00Added an answer on June 14, 2026 at 10:53 am

    You are trying to use a jQuery method on a variable that is simply an html string

    You can convert the variable to a jQuery object element wrapping it in $()

    You can’t concatenate the 2 inputs once one is an object so you would need to reverse the insertion

    code.after( paid_input).after( $(time_input).val(data) )
    /* should place "time_input" before "paid_input"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How can I add key value pairs to an array? This won't work: public
I add these hidden input fields into a panel : foreach (Object obj in
Now I can add single value or tubles to the pipeline, my next question
Can I add an event handler to a session value in asp.net with c#?
How can i reset a display:none and add some value here is the code
If I want to add a value in an array, I can use: $array[]
When you add a DateTimePicker control, you can select part of the control value
I have this table where I can generate dynamic rows (which has input <type=text
How can I add an index, to input names and ids in forms that
I have the following html: <table> <tr> <td> <input type=button id=btnAdd value=Add /> <input

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.