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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:01:24+00:00 2026-05-26T10:01:24+00:00

I have an empty div element and in which I am havin an HTMLtext

  • 0

I have an empty div element and in which I am havin an HTMLtext area and now I have 2 drop down lists one is for font name and the other is for font size.

Now If I write something in the textarea and If I select some font name from the drop down list the text should immediately reflect within the textarea so how do I do that?

Here is my code:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    For Each f As System.Drawing.FontFamily In System.Drawing.FontFamily.Families
        DropFont.Items.Add(f.Name)
    Next
End Sub

This is my design code:

<div class="exampe">
 <textarea name="TextBox1" rows="2" id="TextBox1" cols="20"></textarea>
</div>


  <asp:DropDownList ID="DropFontSize" runat="server">
                                    <asp:ListItem Value="6">6</asp:ListItem>
                                    <asp:ListItem Value="8">8</asp:ListItem>
                                    <asp:ListItem Value="10">10</asp:ListItem>
                                    <asp:ListItem Value="12">12</asp:ListItem>
                                    <asp:ListItem Value="14">14</asp:ListItem>
                                    <asp:ListItem Value="18">18</asp:ListItem>
                                    <asp:ListItem Value="24">24</asp:ListItem>
                                    <asp:ListItem Value="32">32</asp:ListItem>
                                    <asp:ListItem Value="36">36</asp:ListItem>
                                    <asp:ListItem Value="40">40</asp:ListItem>
                                    <asp:ListItem Value="48">48</asp:ListItem>
                                    <asp:ListItem Value="52">52</asp:ListItem>
                                    <asp:ListItem Value="56">56</asp:ListItem>
                                    <asp:ListItem Value="62">62</asp:ListItem>
                                    <asp:ListItem Value="68">68</asp:ListItem>
                                    <asp:ListItem Value="72">72</asp:ListItem>
                                </asp:DropDownList>
  • 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-26T10:01:25+00:00Added an answer on May 26, 2026 at 10:01 am

    You are going to have to use a client side script to achieve what you want to do. Ideally I would suggest using jQuery to plug into the change event of your drop down list and based on the selecetion made either apply a css class to your textarea or use the css property of your textarea to change the font family.

    In your header or stylesheet set:

    <style>
       .arial {
           font-family: arial;
       }
    
       .verdana {
           font-family: verdana;
       }
    </style>
    

    For the following html:

    <select id="fonts">
        <option value="arial">Arial</option>
        <option value="verdana">Verdana</option>
    </select>
    
    <textarea name="TextBox1" rows="2" id="TextBox1" cols="20"></textarea>
    

    use this jQuery to change styles:

    $('#fonts').change(function() {
        var fontfamily = $('#fonts').val();
        $('#TextBox1').removeClass();
        $('#TextBox1').addClass(fontfamily);
    });
    

    Alternatively, to avoid creating all the font classes, just use the css property:

    $('.target').change(function() {
        var fontfamily = $('.target').val();
        $('#TextBox1').css('font-family', fontfamily);
    });
    

    One sticking point you may come across with asp.net is getting the drop down list id as this generated dynamically. You could use a class instead to identify it or use inline script to obtain it’s client id propery within your javascript:

    var ddlId = <%=DropFontSize.ClientID %>;
    var fontfamily = $('#' + ddlId).val();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an empty div <div id=content></div> to which I add content via jquery
I have files which have many empty cells which appear as NaNs when I
I have a couple of elements, one of which may have any number of
I have a empty div identified by parent. I want to put an p
I have an empty unordered list in my design. Now I want to add
Is the ID attribute on an HTML element allowed to be empty? <div id=></div>
I have a TextBox input element that has a RequiredFieldValidator as such: <div> <label>First
I have an input which I need to check whether it is empty or
I have a element in my form. <select name=states disabled=disabled size=10 id=select-states><optgroup label=Choose State
I have a div which in jquery's document ready I append - using $(#div

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.