开发者

Append/Prepend with onclick doesn't work (HELP PLS)

开发者 https://www.devze.com 2023-01-29 12:19 出处:网络
Many hours at this and nothing seems to work. Help please! I need to insert these 3 sets of code: CODE 1: <div onclick=\"openClose(\'stp1\')\" style=\"cursor:hand; cursor:pointer\">

Many hours at this and nothing seems to work. Help please!

I need to insert these 3 sets of code:

CODE 1: <div onclick="openClose('stp1')" style="cursor:hand; cursor:pointer">

CODE 2: </div><div id="stp1" class="texter">

CODE 3: </div>

into this table:

<table id='options_table'>
<tr><td colspan=3><font size="3" class="colors_productname">
<i><b><font size=2>(NEED TO INSERT CODE 1 HERE) STEP 1: (NEED TO INSERT CODE 2 HERE)<font color=red>*</b></i>
</font>
<br /><table cellpadding="0" cellspacing="0" border="0"><tr><td><im开发者_JS百科g src="/images/Line_Group_Features.gif" /></td></tr></table>
</font></td></tr>
<tr>
<td align="right" vAlign="top">
<img src="/images/clear1x1.gif" width="1" height="4" border="0"><br />
</td><td></td><td>

<br><br /></td></tr> (NEED TO INSERT CODE 3 HERE)
<tr><td colspan=3><font size="3" class="colors_productname">
<i><b><font size=2>STEP 2:</b></i>
</font>
<br /><table cellpadding="0" cellspacing="0" border="0"><tr><td><img src="/images/Line_Group_Features.gif" /></td></tr></table>
</font></td></tr>
<tr>
....

I've tried this:

$("img[src$='Line_Group_Features.gif']:eq(0)").closest('font').prepend('<div onclick="openClose(\'stp1\')" style="cursor:hand; cursor:pointer">');
$("img[src$='Line_Group_Features.gif']:eq(0)").closest('font').append('</div><div id="stp1" class="texter">');
$("img[src$='Line_Group_Features.gif']:eq(1)").prev('tr'):eq(.append('</div>');

and this:

$("img[src$='Line_Group_Features.gif']:eq(0)").closest('font').prepend('<div id="clickstp1" style="cursor:hand; cursor:pointer">');
$("img[src$='Line_Group_Features.gif']:eq(0)").closest('font').append('</div><div id="stp1" class="texter">');
$("img[src$='Line_Group_Features.gif']:eq(1)").closest('font').prepend('</div>');
$('#clickstp1').bind('click', function()) {  openClose('stp1');});

but nothing's working.


you should be able to do this:

$("img[src$='Line_Group_Features.gif']:eq(0)").before('<div onclick="openClose(\'stp1\')" style="cursor:hand; cursor:pointer">');
$("img[src$='Line_Group_Features.gif']:eq(0)").after('</div><div id="stp1" class="texter">');


I dont think this is going to work for you even if you get the insertion correct because:

  1. im pretty sure font is an inline element and thus cant contain a block level element like div
  2. div is not valid outside of a td or th in a table/tbody/thead.
0

精彩评论

暂无评论...
验证码 换一张
取 消