Change Textbox Value based on Select Box using Javascript & Jquery | Sanwebcorner

Change Textbox Value based on Select Box using Javascript & Jquery

Here i will tell you how to change the text box value based on above selected box value. This simple concept will done by using the JavaScript and Jquery. In this example i am taking the state when you selected the state from the drop down list it will display in the below text box. The selected value is passed from the select box to text box. The text box is read only you can't able to change the text box value. 

This value will passed the value using ids with the help of javascript. In this example have the live demo link, Please check out the demo and also download the code and use it. I hope this concept is very helpful to you

<!DOCTYPE html>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title>Change Textbox Value Based on Select Box</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="robots" content="noindex, nofollow">
<meta name="googlebot" content="noindex, nofollow">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">
select, input
{   width: 200px;
padding: 12px;
margin:0 auto;


width: 350px;
margin: 0 auto;
display: block;
padding: 40px;
background-color: #4EAD51;
<script type="text/javascript">

$(document).ready(function() {

$("#state1 option").filter(function() {
return $(this).val() == $("#state").val();
}).attr('selected', true);

$("#state1").live("change", function() {




<div class="sandiv">
<h1 style="color:#fff;">Change Textbox Value Based on Select Box</h1>
<select id="state1" name="state1">
<option value="">Please State...</option>
<option value="Andhra">Andhra</option>
<option value="TamilNadu">TamilNadu</option>
<option value="Karnataka">Karnataka</option>
<option value="Kerala">Kerala</option>
Your Selected State <input type="text" id="state" name="state" value="" readonly="readonly">
<h3><a href=""></a></h3>
if (window.parent && window.parent.parent){
window.parent.parent.postMessage(["resultsFrame", {
height: document.body.getBoundingClientRect().height,
slug: "nafnR"
}], "*")

Post a comment


360 degree view product image 3d rotate 3d text 3step-form Accordion menu ajax All Browsers Animated Background Gradient animation audio controller auto complete Best accordion menu bootstrap Bootstrap form validation border bounce effect on hover Breadcrumb calculate age by dob calendar Captcha change image on mouse move color chooser countdown Counter on scroll create random number Css css animation css buttons css hover css3 customized upload Button Date picker delete data from table Different scroll speed donation form download zip email otp verification email verifier Embed eventlist Expanding Menu feedbck form flash news section close button full screen menu Google custom search Google Maps Google reCAPTCHA Google site search gradient heart animation hide menu Horizontal News ticker Hover Htm Html html dropdown html form html form validation html5 html5 form validation Iframe image hover increment decrement textbox value based on select box Javascript javascript validation Jquery jquery validation js Layered image effect on mouse hover lock & unlock page scroll marquee marquee with close button mobile number validation mobile otp login Multi-level-drop-down-menu multi-level-form multi-select-checkbox Multi-Step-form Multiple File Upload in PHP mysql News ticker on hover change text to image our team page password generator password strength checker paypal form paypal html form Photoshop PHP php mailer populate html selectbox Popup image on click the link pure css Question type form random number generate Random password Redirect page Based on the select box while submit the form responsive responsive menu responsive popup box Responsive Vertical Time line design rotate image selectbox based on select box simple coming soon page simple countdown based on end date simple typing effect slider sliding tab sms otp login statistic counter on scroll switch tag shape team member Time picker toggle toggle view transparent button underline animation up down slide validation vertical fixed sidebar Webtips whatsapp link website Whislist Youtube