I have this:
var swal = json.Event[i].SwURL;
$("#swurl").append("value='"+ swal +"'");
What I'm trying to achieve is to make the swal
become the value in the form that I have. However it doesn't seem to be doing anything:
<input autofocus="autofocus" class="form-control" id="swurl"
type="text" value="" name="event[swlink]">
This is the html:
Edit
Due to the nature of this potentially being a duplicate.
I've attempted this method
$("#swurl").val(swal);
However this hasn't worked.
Also I'm wondering if its because the javascript_tag is taking a while to load, Therefore not being inserted into the simple form.
Hers the simple form field if anyone was wondering
<div class="form-group">
<%= f.label :swlink %>
<div class="row">
<div class="col-md-6">
<%= f.text_field :swlink, :autofocus => true, class: "form-control", id: "swurl" %>
</div>
</div>
</div>