질문드립니다!! 채택완료
http://hjin9320000.cafe24.com/bbs/write.php?bo_table=hahahahahha" style="font-family: dotum, sans-serif; font-size: 12px; line-height: 1.5; box-sizing: border-box; color: rgb(0, 0, 0); text-decoration: none; cursor: pointer; background-image: initial; background-attachment: initial; background-size: initial; background-origin: initial; background-clip: initial; background-position: 0px 0px; background-repeat: initial;">http://hjin9320000.cafe24.com/bbs/write.php?bo_table=hahahahahha
클릭 후 제품을 확인하세요. 여길 클릭하면 테이블이 쭈욱 나오는데
혹시 여기서 한 품목을 클릭했을때 다른 여분필드가 있다는 가정하에 그 필드로 텍스트 그대로 복사되는게 가능할까요?
혹시나 해서 여쭤봅니다 ㅎㅎㅎ
비슷한 형식의 스킨이 있을까요?
답변 2개
만들어야하지 않을까요???
리스트가 나오는 테이블에 클래스나 아이디값을주세요.
그리고 새로 생길 여분필드에도 아이디나 클래스값을주세요.
저는 중복을 싫어해서 다중제어가 아니면 대부분 아이디써요 ㅎ
그리고 제이쿼리로 하시면 될것같아요.
</p><p>$("#tableid tbody tr").click(function(){</p><p> $("#text1").text(<span style="font-size: 11pt; line-height: 1.5;">$(this).children(*).text());</span></p><p><span style="font-size: 14.6666669845581px; line-height: 1.5;"> $("#text2").text(</span><span style="font-size: 11pt; line-height: 1.5;">$(this).</span><span style="font-size: 14.6666669845581px; line-height: 1.5;">children</span><span style="font-size: 11pt; line-height: 1.5;"></span><span style="font-size: 11pt; line-height: 1.5;">(*).text());</span></p><p><span style="font-size: 11pt; line-height: 1.5;"></span></p><p>});</p><p>
1. 리스트가 있는 테이블의 아이디값이 tableid이고 여기의 tbody > tr을 클릭시 진행하는거고요.
2. $(this).children(*).text() 이건 현재 선택한것인 tr의 자식중 선택한것의 텍스트값을 text1이라는 여분필드에 넣는다는거에요.
여기서 children의 아스테리크(*)는 td에 아이디나 클래스를 줘서 선택하셔도되고 몇번째자식인지 선택하셔도 되고 하는거니 편하신거 넣으시면되요.
답변에 대한 댓글 1개
댓글을 작성하려면 로그인이 필요합니다.
</p><input type="text" readonly id="text1" /><div><input type="text" readonly id="text2" /></div><div><table id="tableId"></div><div> <tbody></div><div> <tr></div><div> <td class="text1">Dimension_IN(WxDxH)mm</td></div><div> <td class="text2">150Φ – Bottle size</td></div><div> </tr></div><div> <tr></div><div> <td class="text1">Dimension_OUT(WxDxH)mm</td></div><div> <td class="text2">220 x 345 x 203</td></div><div> </tr></div><div> <tr></div><div> <td class="text1">Exterior</td></div><div> <td class="text2">Stainless steel & ABS mold</td></div><div> </tr></div><div> <tr></div><div> <td class="text1">Pump</td></div><div> <td class="text2">Oilless pump , High efficiency & powerful performance low noise, low vibration & leak tight 600㎜Hg / 6kgf/㎠ / 12ℓ/min , 18 ~ 24liter</td></div><div> </tr></div><div> </tbody></div><div></table></div><div>
</div><div><script type="text/javascript"></div><div>$("#tableid tbody tr").click(function(){</div><div> $("#text1").text($(this).children(".text1").text());</div><div> $("#text2").text($(this).children(".text2").text());</div><div>});</div></script><p>
이렇게하면되요
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인