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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T03:27:57+00:00 2026-05-15T03:27:57+00:00

Hi i need with jQuery to change data in input field when user click

  • 0

Hi i need with jQuery to change data in input field when user click on some link

<input value="height-size-width">

so when user click on some

<a href = "#" id="width">

link need to change only widht in input field….

if user click

<a href = "#" id="height">

link script need to change only height in input field…

Like youtube embed option
Any help?

  • 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-05-15T03:27:58+00:00Added an answer on May 15, 2026 at 3:27 am
    <input id="embed-code" size="60" />
    <h3>Select size:</h3>
    <ul id="embed-size-options">
        <li><a href="#" data-width="640" data-height="480" class="selected">640x480</a></li>
        <li><a href="#" data-width="800" data-height="600">800x600</a></li>
        <li><a href="#" data-width="1024" data-height="768">1024x768</a></li>
    </ul>
    
    <h3>Select color:</h3>
    <ul id="embed-color-options">
        <li><a href="#" data-color="#ff0000" class="selected">red</a></li>
        <li><a href="#" data-color="#00ff00">green</a></li>
        <li><a href="#" data-color="#0000ff">blue</a></li>
    </ul>
    
    <script src="jquery-1.4.2.min.js"></script>
    <script src="sprintf-0.6.js"></script>
    <script>
        $(function() {
            var $embed_code = $('#embed-code'),
                $embed_size_options = $('#embed-size-options'),
                $embed_color_options = $('#embed-color-options'),
                $selected_size = $embed_size_options.find('a.selected').eq(0),
                $selected_color = $embed_color_options.find('a.selected').eq(0),
                code_tpl = 'current width %s and height %s and color %s';
            if (!$selected_size) {
                $selected_size = $embed_size_options.find('a').eq(0).addClass('selected');
            }
            if (!$selected_color) {
                $selected_color = $embed_color_options.find('a').eq(0).addClass('selected');
            }
            generate_embed_code();
    
            $embed_size_options.find('a').click(function() {
                $selected_size.removeClass('selected');
                $selected_size = $(this).addClass('selected');
                generate_embed_code();
                return false;
            });
            $embed_color_options.find('a').click(function() {
                $selected_color.removeClass('selected');
                $selected_color = $(this).addClass('selected');
                generate_embed_code();
                return false;
            });
            function generate_embed_code() {
                $embed_code.val(sprintf(code_tpl, $selected_size.attr('data-width'), $selected_size.attr('data-height'), $selected_color.attr('data-color')));
            }
        });
    </script>
    

    Is this what you want?

    (I used this JavaScript sprintf() implementation to generate the embed code)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In the callback of a HttpRequest I have, I run this jQuery code: $(input[value='+data.notetype+']).click();
I need to change a bunch of different words on a page using jQuery.
I need to have a JQuery color Picker, where I can change the different
Please i need to change color of a single character in textarea using JQuery.
I need some jQuery assistance. I'm using https://github.com/jbutz/bootstrap-lightbox for my lightbox, basically what I
using jquery I need to retrieve an array from table cells, format the data
i have a simple text input field users put in a number. I need
Trying to learn some jquery to implement an autosave feature and need some assistance.
I need some help I am new to jQuery and I am trying to
Simple text field change after jquery auto complete select event. I want to split

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.