tags:

views:

255

answers:

1

Hi,

I have below html code in my aspx.

<input type="hidden" id="medicalLink" value='<a href="/forms/contactus.aspx" >Contact Us</a>' />

I want to pass complete href value of above input type to my below code when page gets rendered.

<div class="label" id="lblMedicalLink">
                    Medical and Travel insurance?:
                    <a href="#">Click</a>

                    <span class="asterisk" title="This field is mandatory">*</span></div>

After the page gets rendered, it will be show below code:

<div class="label" id="lblMedicalLink">
                    Medical and Travel insurance?:
                    <a href="/forms/contactus.aspx">Click Here</a>

                    <span class="asterisk" title="This field is mandatory">*</span></div>

I would appreciate if I can get answer in Jquery.

A: 
$(document).ready ( function () {
      $("#anchToReplace").replaceWith ( $("#medicalLink" ).val() );
     });

I added an id [anchToReplace] to the anchor tag.

Hope this helps.

rahul
Thanks Phoenix! it works!
MKS