I Googled this for half an hour and cant find the solution but I think this should be something really simple.
This is my code
<input name="order[name]" id="order[name]" type="text">
<script>
$(document).ready(function(){
$("#previewForm").click(function(){
var orderName = $("input[type=text][name='order[name]']").val();
$( "#contactCollected" ).text( orderName );
});
});
</script>
I want the user to preview the form that he just filled.
Replacing
$( "#contactCollected" ).text( orderName );
with
$( "#contactCollected" ).text( 'some text' );
works so I think it's the selector problem. I can provide more code if necessary.
EDIT: It appears this works as is, I'm not even sure where in the process I replaced one mistake with another one.
Thanks For all the folks in comments especialy @Barmar and @Jonathan.Brink .
I wouldn't delete the question because of the discussion on naming ID's in input elements but I'm not sure about the rules.
Thank you everyone for your time and I apologise once more for not trying out the jsfiddle right away.