javascript - Why it won't pass the string to input field but it shows in HTML? -
when loads, can see key this
 your key: shf8tg382kds
 however, key won't appear in input field.
 why? , how can solve this?
javascript part
<script>     window.onload = function(){         $(".chat#key").val($('#peer-id').text()).focus()     } </script>   html part
<p>your key : <span id="peer-id"></span> </p>  <input class="chat" id="key" name="messages[body]" placeholder="type key here!" type="text" />   update
if change this, shows abc in input field.
$(".chat#key").val('abc').focus()       
 
  
Comments
Post a Comment