selector - change labels value with javascript, when no id or class -
can me changing value javascript, code no have id or class here code:
<label for="flights-origin-prepop-whitelabel_en">origin</label> i want change "origin" different word.
some examples of code:
<button role="flights_submit" type="submit">search</button> <div class="mewtwo-flights-destination"> <label for="flights-destination-prepop-whitelabel_en">destination</label> <input type="text" name="destination_name" autocomplete="off" required="" id="flights-destination-prepop-whitelabel_en" placeholder="destination" data-label="destination" role="flights-destination" data-modal-modifier="whitelabel_en" data-placeholder-initialized="true"> <input type="hidden" name="destination_iata" id="flights-destination-whitelabel_en" value=""> </div> how can change placeholder "destination", , label text destination?
thanks
you can change origin texto doing this:
document.queryselector("label[for='flights-origin-prepop-whitelabel_en']").textcontent = 'new text';
Comments
Post a Comment