Solved

style textboxes as labels

Posted on 2011-09-19
3
328 Views
Last Modified: 2012-05-12
I am just interested in the content of the textboxes.

Essentially, I want to make the information "read-only" by styling the textboxes as simple text labels.  Or I guess "turn them into" <span> tags.

How can I do this?

<div id="ctl00_ContentPlaceHolder1_BillingInfo1_aoebillfirstname" class="fieldformatting">First Name:<font color="red">*</font>
<input name="ctl00$ContentPlaceHolder1$BillingInfo1$tbFirstName" type="text" value="W" id="ctl00_ContentPlaceHolder1_BillingInfo1_tbFirstName" style="width:255px;" /></div>

would become:

<div id="ctl00_ContentPlaceHolder1_BillingInfo1_aoebillfirstname" class="fieldformatting">First Name:  <span id="ctl00_ContentPlaceHolder1_BillingInfo1_tbFirstName" style="width:255px;">W</span></div>

The drop down lists would just show the selected option value as a label.

<div id="aeosubparaheader" class="aoebillingheader">
<b><span id="ctl00_ContentPlaceHolder1_BillingInfo1_BillingInfoHeader">Credit Card Billing Info:</span></b>
</div>
<div id="ctl00_ContentPlaceHolder1_BillingInfo1_aoebillfirstname" class="fieldformatting">First Name:<font color="red">*</font>
<input name="ctl00$ContentPlaceHolder1$BillingInfo1$tbFirstName" type="text" value="W" id="ctl00_ContentPlaceHolder1_BillingInfo1_tbFirstName" style="width:255px;" /></div>
<div id="ctl00_ContentPlaceHolder1_BillingInfo1_Div1" class="fieldformatting">

Last Name:<font color="red">*</font>
<input name="ctl00$ContentPlaceHolder1$BillingInfo1$tbLastName" type="text" value="W" id="ctl00_ContentPlaceHolder1_BillingInfo1_tbLastName" style="width:255px;" /></div>
<div id="ctl00_ContentPlaceHolder1_BillingInfo1_Div2" class="fieldformatting">
Address:<font color="red">*</font>
<input name="ctl00$ContentPlaceHolder1$BillingInfo1$tbAddress1" type="text" value="W" id="ctl00_ContentPlaceHolder1_BillingInfo1_tbAddress1" style="width:255px;" /></div>
<div id="ctl00_ContentPlaceHolder1_BillingInfo1_Div3" class="fieldformatting">
Address2:
<input name="ctl00$ContentPlaceHolder1$BillingInfo1$tbAddress2" type="text" id="ctl00_ContentPlaceHolder1_BillingInfo1_tbAddress2" style="width:255px;" /></div>
<div id="ctl00_ContentPlaceHolder1_BillingInfo1_Div4" class="fieldformatting">
City:<font color="red">*</font>
<input name="ctl00$ContentPlaceHolder1$BillingInfo1$tbCity" type="text" value="W" id="ctl00_ContentPlaceHolder1_BillingInfo1_tbCity" style="width:255px;" /></div>


<div id="DivStateAndZip" class="billingstateandzipwrapper">
<div id="ctl00_ContentPlaceHolder1_BillingInfo1_Div555" class="billingstatewrapper">
<div id="ctl00_ContentPlaceHolder1_BillingInfo1_Div5" class="billingstatefieldformatting">
State:<font color="red">*</font></div>
<div id="ctl00_ContentPlaceHolder1_BillingInfo1_Div55" class="specialbillingstateddl"><select name="ctl00$ContentPlaceHolder1$BillingInfo1$statesuser$ddlState" id="ctl00_ContentPlaceHolder1_BillingInfo1_statesuser_ddlState" style="width:100px;">
	<option selected="selected" value="AL">Alabama</option>
	<option value="AK">Alaska</option>
	<option value="AZ">Arizona</option>
	<option value="AR">Arkansas</option>
...
...
	<option value="WV">West Virginia</option>
	<option value="WI">Wisconsin</option>
	<option value="WY">Wyoming</option>

</select>
</div>
</div>

<div id="ctl00_ContentPlaceHolder1_BillingInfo1_Div7" class="billingzipfieldformatting">
Zip:<font color="red">*</font>
<input name="ctl00$ContentPlaceHolder1$BillingInfo1$tbZip" type="text" value="A" id="ctl00_ContentPlaceHolder1_BillingInfo1_tbZip" style="width:60px;" /></div>
</div>

<div id="ctl00_ContentPlaceHolder1_BillingInfo1_Div888" class="fieldformatting">
Country:<font color="red">*</font><select name="ctl00$ContentPlaceHolder1$BillingInfo1$countriesuser$ddlCountry" id="ctl00_ContentPlaceHolder1_BillingInfo1_countriesuser_ddlCountry" style="width:257px;">
	<option selected="selected" value="US">United States</option>

	<option value="AF">Afghanistan</option>
	<option value="AL">Albania</option>
	<option value="DZ">Algeria</option>
...
...
	<option value="US">United States</option>
	<option value="UM">United States Minor Is.</option>
	<option value="UY">Uruguay</option>
	<option value="UZ">Uzbekistan</option>
	<option value="VU">Vanuatu</option>

</select>

</div>

<div id="ctl00_ContentPlaceHolder1_BillingInfo1_Div9" class="fieldformatting">
E-Mail:<font color="red">*</font>
<input name="ctl00$ContentPlaceHolder1$BillingInfo1$tbEmail" type="text" value="Tom.Knowlton@total-computing.com" id="ctl00_ContentPlaceHolder1_BillingInfo1_tbEmail" style="width:255px;" />
</div>

<div id="" class="dayandnightphonewrapper">
    <div id="ctl00_ContentPlaceHolder1_BillingInfo1_dpff" class="dayphonefieldformatting">
    Day Phone:<font color="red">*</font>
    <input name="ctl00$ContentPlaceHolder1$BillingInfo1$tbDayPhone" type="text" value="111day" id="ctl00_ContentPlaceHolder1_BillingInfo1_tbDayPhone" style="width:90px;" />

    </div>
   
    <div id="ctl00_ContentPlaceHolder1_BillingInfo1_Div11" class="nightphonefieldformatting">
    Evening:
    <input name="ctl00$ContentPlaceHolder1$BillingInfo1$tbNightPhone" type="text" value="eve" id="ctl00_ContentPlaceHolder1_BillingInfo1_tbNightPhone" style="width:90px;" />
    </div>
</div>

<div id="ctl00_ContentPlaceHolder1_BillingInfo1_Div12" class="keepinformedfieldformatting">
</div>

    

<div class="aoeshippingheader">
<b>Shipping Information:</b>

</div>

<div id="ctl00_ContentPlaceHolder1_ShippingInfo1_copybillingtoshippingdiv" class="copybilltoship">
<input id="ctl00_ContentPlaceHolder1_ShippingInfo1_CheckBoxCopyBillToShip" type="checkbox" name="ctl00$ContentPlaceHolder1$ShippingInfo1$CheckBoxCopyBillToShip" onclick="javascript:setTimeout('__doPostBack(\'ctl00$ContentPlaceHolder1$ShippingInfo1$CheckBoxCopyBillToShip\',\'\')', 0)" /><label for="ctl00_ContentPlaceHolder1_ShippingInfo1_CheckBoxCopyBillToShip"> Same as Billing?</label>
</div>

<div id="ctl00_ContentPlaceHolder1_ShippingInfo1_Div1" class="shippingfieldformatting">Ship to Name:<font color="red">*</font><input name="ctl00$ContentPlaceHolder1$ShippingInfo1$tbShipFirstName" type="text" value="W W" id="ctl00_ContentPlaceHolder1_ShippingInfo1_tbShipFirstName" style="width:255px;" /></div>
<div id="ctl00_ContentPlaceHolder1_ShippingInfo1_Div2" class="shippingfieldformatting">Address:<font color="red">*</font><input name="ctl00$ContentPlaceHolder1$ShippingInfo1$tbShipAddress1" type="text" value="W" id="ctl00_ContentPlaceHolder1_ShippingInfo1_tbShipAddress1" style="width:255px;" /></div>
<div id="ctl00_ContentPlaceHolder1_ShippingInfo1_Div3" class="shippingfieldformatting">Address2:<input name="ctl00$ContentPlaceHolder1$ShippingInfo1$tbShipAddress2" type="text" id="ctl00_ContentPlaceHolder1_ShippingInfo1_tbShipAddress2" style="width:255px;" /></div>
<div id="ctl00_ContentPlaceHolder1_ShippingInfo1_Div4" class="shippingfieldformatting">City:<font color="red">*</font><input name="ctl00$ContentPlaceHolder1$ShippingInfo1$tbShipCity" type="text" value="W" id="ctl00_ContentPlaceHolder1_ShippingInfo1_tbShipCity" style="width:255px;" /></div>





<div id="shipstatezipwrap" class="shippingstateandzipwrapper">
<div id="Div555666" class="specialstatewrapper">
<div id="ctl00_ContentPlaceHolder1_ShippingInfo1_Div5" class="shippingstatefieldformatting">State:<font color="red">*</font></div>
<div id="66" class="specialshippingstatedll"><select name="ctl00$ContentPlaceHolder1$ShippingInfo1$statesshipping$ddlState" id="ctl00_ContentPlaceHolder1_ShippingInfo1_statesshipping_ddlState" style="width:100px;">
	<option selected="selected" value="AL">Alabama</option>
	<option value="AK">Alaska</option>
	<option value="AZ">Arizona</option>
	<option value="AR">Arkansas</option>
...
...
	<option value="WV">West Virginia</option>
	<option value="WI">Wisconsin</option>
	<option value="WY">Wyoming</option>
</select>
</div>
</div>
<div id="ctl00_ContentPlaceHolder1_ShippingInfo1_Div6" class="shippingzipfieldformatting">Zip:<font color="red">*</font><input name="ctl00$ContentPlaceHolder1$ShippingInfo1$tbShipZip" type="text" value="A" id="ctl00_ContentPlaceHolder1_ShippingInfo1_tbShipZip" style="width:60px;" /></div>
</div>
<div id="Div777888" class="shippingfieldformatting">
Country:<font color="red">*</font>
<select name="ctl00$ContentPlaceHolder1$ShippingInfo1$countriesshipping$ddlCountry" id="ctl00_ContentPlaceHolder1_ShippingInfo1_countriesshipping_ddlCountry" style="width:257px;">
	<option selected="selected" value="US">United States</option>
	<option value="AF">Afghanistan</option>
	<option value="AL">Albania</option>
	<option value="DZ">Algeria</option>
...
...
	<option value="US">United States</option>
	<option value="UM">United States Minor Is.</option>
	<option value="UY">Uruguay</option>
	<option value="UZ">Uzbekistan</option>
	<option value="VU">Vanuatu</option>
</select>

</div>

<div id="shipin" class="shipinstwrap">
<div id="ctl00_ContentPlaceHolder1_ShippingInfo1_Div8" class="shipinstrshippingfieldformatting"><div id="ctl00_ContentPlaceHolder1_ShippingInfo1_shipins" class="shipinstrtext">Ship Instructions:</div></div>
<textarea name="ctl00$ContentPlaceHolder1$ShippingInfo1$tbShipInstructions" rows="2" cols="20" id="ctl00_ContentPlaceHolder1_ShippingInfo1_tbShipInstructions" style="height:50px;width:255px;position:relative;float:left;margin-top:2px;"></textarea>
</div>


</div>





<table cellpadding="5" cellspacing="0" border="0" width="100%">
<tr>
<td valign="top" style="width:300px;">



&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a id="ctl00_ContentPlaceHolder1_lbGoToMyAccount" href="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;ctl00$ContentPlaceHolder1$lbGoToMyAccount&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, true))">Click here to change your address on file</a><br />



</asp:Panel>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="font-size:12px;"><input id="ctl00_ContentPlaceHolder1_cbCustomShip" type="checkbox" name="ctl00$ContentPlaceHolder1$cbCustomShip" onclick="javascript:setTimeout('__doPostBack(\'ctl00$ContentPlaceHolder1$cbCustomShip\',\'\')', 0)" /><label for="ctl00_ContentPlaceHolder1_cbCustomShip">Check to use a 'this time only' shipping address</label></span>

Open in new window


0
Comment
Question by:Tom Knowlton
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 400 total points
ID: 36562417
First try : http://jsfiddle.net/7emyt/
$(":text", ".fieldformatting").each(function() {
    $(this).replaceWith("<span id='" + $(this).attr("id") + "' style='" + $(this).attr("style") + "'>" + $(this).val() + "</span>")
})
0
 
LVL 40

Assisted Solution

by:gurvinder372
gurvinder372 earned 100 total points
ID: 36562419
var input = $(".fieldformatting input");

var html = "<span id='" + input.attr("id") +"' style='" + input.attr("style") + "' >" + input.val() + "</span>";
 $(".fieldformatting input").remove();
 $(".fieldformatting").append(html);
0
 
LVL 5

Author Closing Comment

by:Tom Knowlton
ID: 36563090
thx
0

Featured Post

Is Your DevOps Pipeline Leaking?

Is your CI/CD pipeline a hodge-podge of randomly connected tools? You’ve likely got a tool to fix one problem & then a different tool to fix another, resulting in a cluster of tools with overlapping functionality. Learn how to optimize your pipeline with Gartner's recommendations

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

PROBLEM: The other day I was working on adding an ajax request to a webpage that already had a dialog box on the page.  The dialog box was using relative positioning to be positioned next to a form field I had on the page.  Everything was working…
Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question