从加载模式的输入文本id获取img src

How to pass input type image (name of pic) to img src inside div, when load modal?

<div class="form-group">
  <label for="image" class="col-sm-2 control-label">
    <?=l ang( 'image') ?>
  </label>
  <div class="col-sm-4">
    <input type="image" id="pimage" width="300px">
  </div>
</div>


<script>
  var imageSrc = 'http://ricap.pt/encomendas/assets/uploads/' + pimage + '';
  var input = document.getElementById('pimage');
  input.src = imageSrc;
</script>

This show blank div and is getting the name of image

Pic url : http://ricap.pt/encomendas/assets/uploads/2774cc3506ee269c379b215d3a1876d5.jpg

Try this:

 var imageSrc = 'http://ricap.pt/encomendas/assets/uploads/' + pimage + '';
$('#pimage').parent().append('<img src="'imageSrc'">');

The problem is you don't have a src="" in your tag, so you're trying to edit an attribute that isn't there. Add a blank attribute to your code like this:

<input src="" type="image" id="pimage" width="300px">

input.src doesn't add an attribute; it only changes what is already there.

As you mentioned in your comment, you could also do that with PHP like this:

<input src="assets/uploads/<?php echo $row->image; ?>" type="image" id="pimage" width="300px">