What I did already is as user writes some text, script adds it to UTL and loads a picture under the text input box.
What I want to do more is to be able to split input text by space (ex. A1369 A2453
should be sliced into two variables A1369
and A2453
) and use these two variables to load all the pictures below input box.
The string length has to be unlimited.
I have read and tried to understand javascript split function, but had no success using it yet.
Code that I have now below:
<script type="text/javascript">
document.getElementById('btn').onclick = function() {
var val = document.getElementById('imagename').value,
src = 'http://s7ondemand6.scene7.com/is/image/MothercareASE/l' + val.toLowerCase() +'_1?&$dw_large_mc$&wid=1059&hei=1272',
img = document.createElement('img');
img.src = src;
parentElement.insertBefore(img, parentElement.firstChild);
}
</script>
How do I add the splicing using the String.prototype.split
function?