skip to Main Content

Loop on html objects and obtain a single array of objects – Jquery

I have some html objects like: <input id="myfield1" class="fields_to_iterate"> <input id="myfield2" class="fields_to_iterate"> <input id="myfield3" class="fields_to_iterate"> <input id="myfield4" class="fields_to_iterate"> <input id="myfield5" class="fields_to_iterate"> and if I do in javascript: $('.fields_to_iterate').each( (index, element) => { myObject.push( { [$(element).attr('id')] : $(element).val() } ); });…

VIEW QUESTION

If textarea contains this text then run query – Jquery

This is my code: $(document).ready(function () { if ($("#write_text_id").text() === "Saurav & Kunal Are God") { $(".submit_form_field").addClass('item-3'); } }); <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <div class="test"> <textarea id="write_text_id" class="textarea small" tabindex="105" placeholder="Write Saurav &amp; Kunal Are God" rows="4" cols="50"></textarea> <input id="submit_btn_id" class="submit_form_field" type="submit"…

VIEW QUESTION
Back To Top
Search