Best Approach to populate inputs on the page


#1

Hey guys,
In your opinion, what is the best approach to pass data to a input field?

Usually I do things like:
<input type="text" value="{{ data ? data : '' }}">

But sometimes I prefer (or need because of a plugin) to use jquery, for select fields for example is more easy add this in the end of my template.

<script>
  $("[type='select]'").val({{data}})
</script>

But I am not sure if this is correctly, since my page will have a bunch of script tags when rendered and I don’t know if this is a good practice or cause issues with performance.

Thanks