알 수없는 ID를 가진 알 수없는 입력 상자가 있습니다. 입력 상자를 클릭하여 값을 다듬어서 div를 채우고 싶습니다. 내가 첫 번째 클릭에 표시되는 값을 갖고 싶어 JSFiddlediv에 표시된 트리밍 된 입력 값
내 코드 입력 필드를 편집하면 예상대로 모든 작품
하지만 / 초점을 맞 춥니 다.
이것은 내가 작성한 JS 함수입니다.
JS
$('input').each(function() {
var $tthis = $(this),
defaultValue = $tthis.val();
defaultValue = defaultValue.substring(keyed.indexOf("|") + 1);
defaultValue = defaultValue.substring(0, defaultValue.length - 2)
$("#target").html(defaultValue);
});
HTML
<input
id='thistext$index'
type='text'
onclick='this.select();'
onfocus="
document.getElementById('show_hide').style.display='block';
document.getElementById('show_hide2').innerHTML = 'Copy this text into the wiki, it will display as: ';"
onblur="document.getElementById('show_hide').style.display='none';" value='[[http://www.example.com/$dirArray[$index]|$dirArray[$index]]]' />
<div id='show_hide'>
<div id='show_hide2'>
</div>
<div id='target'>
</div>
</div>
. 그렇지. 굉장해! - 감사. – redditor