How do I get the (html) id from the select tag on rails_admin?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


How do I get the (html) id from the select tag on rails_admin?



The 'rails_admin' generate this HTML below, I need to change the options of another 'select' tag depending on which 'option' is selected in this 'select' tag, with a coffescript/jquery.
The id= of this 'select' tag is "schedule_tasks_attributes_1532831082497_service_id".
How do I get this id with this number inside? This is not a fixed number.


<div class="form-group control-group belongs_to_association_type service_field "id="schedule_tasks_attributes_1532831082497_service_id_field">
<label class="col-sm-2 control-label" for="schedule_tasks_attributes_1532831082497_service_id">Service</label>
<div class="col-sm-10 controls">
<select data-filteringselect="true" data-options="{&quot;xhr&quot;:false,&quot;remote_source&quot;:&quot;/admin/service?associated_collection=serviceu0026compact=trueu0026current_action=createu0026source_abstract_model=task&quot;}" placeholder="Buscar" name="schedule[tasks_attributes][1532831082497][service_id]" id="schedule_tasks_attributes_1532831082497_service_id" style="display: none;">
<option value=""></option>
<option value="5">Service 5</option>
<option value="4">Service 4</option>
<option value="3">Service 3</option>
<option value="2">Service 2</option>
<option value="1">Service 1</option>
</select>
<div class="input-group filtering-select col-sm-2" data-input-for="schedule_tasks_attributes_1532831082497_service_id" style="float: left;">
<input type="text" class="form-control ra-filtering-select-input ui-autocomplete-input" style="display: inline-block;" placeholder="Buscar" required="required" autocomplete="off">
<span class="input-group-btn">
<label class="btn btn-info dropdown-toggle" data-toggle="dropdown" aria-expanded="false" title="Show All Items" role="button">
<span class="caret"></span>
<span class="ui-button-text">&nbsp;</span>
</label>
</span>
</div>
<a data-link="/admin/service/new?modal=true" class="btn btn-info create" style="margin-left:10px" href="#">
<i class="icon-plus icon-white"></i>
Add new service
</a>
<a data-link="/admin/service/__ID__/edit?modal=true" class="btn btn-info update disabled" style="margin-left:10px" href="#">
<i class="icon-pencil icon-white"></i>
Edit service
</a>
<span class="help-block">Required. </span>
</div>
</div>




1 Answer
1



You can use the following codes in jquery to select the mentioned select tag.


$("[id ^='schedule_tasks_attributes_']")


$("[id $='schedule_tasks_attributes_']")






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Arduino Mega cannot recieve any sketches, stk500_recv() programmer is not responding

Visual Studio Code: How to configure includePath for better IntelliSense results

C++ virtual function: Base class function is called instead of derived