We help IT Professionals succeed at work.
Get Started

Jquery inject html

Solutionabc
Solutionabc asked
on
484 Views
Last Modified: 2012-06-21
Hi,

I want to wrap my input element in a span tag but unsure how to do it. My code is as follows.
The only unique identifier is the inputs id and name.

How can I do this using jquery?

Thanks!
<td class="genericFormCell">

<div class="genericFormFieldRollNumber>

<strong>Roll Number</strong>

</div>

<div class="genericFormInputRollNumber">

<input name="ctl00$m$g_050451fe_f59b_43d9_9bbd_ee37318e73f3$Roll Number" class="genericFormFieldRollNumber" id="ctl00_m_g_050451fe_f59b_43d9_9bbd_ee37318e73f3_Roll Number" style="width: 400px;" type="text" maxlength="255"/>

</div>

</td>

I want to change it to:

<td class="genericFormCell">

<div class="genericFormFieldRollNumber>

<strong>Roll Number</strong>

</div>

<div class="genericFormInputRollNumber">

<span id="custom">


<input name="ctl00$m$g_050451fe_f59b_43d9_9bbd_ee37318e73f3$Roll Number" class="genericFormFieldRollNumber" id="ctl00_m_g_050451fe_f59b_43d9_9bbd_ee37318e73f3_Roll Number" style="width: 400px;" type="text" maxlength="255"/>

</span>

</div>

</td>

Open in new window

Comment
Watch Question
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE