[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 336
  • Last Modified:

style textboxes as labels

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
Tom Knowlton
Asked:
Tom Knowlton
2 Solutions
 
leakim971PluritechnicianCommented:
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
 
Gurvinder Pal SinghCommented:
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
 
Tom KnowltonWeb developerAuthor Commented:
thx
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now