I have a Sharepoint custom list where the users can add new items. I have 2 textbox ("A" & "B") and I would like to insert a value to "B" if "A" is changed. Problems:
1. How to select a textbox?
To begin I tryed to simply insert a text to textbox "A" based on this, but I was not successful. Here is my code:
<script type="text/javascript">
$(function () {
$('input[name="Test"]').val('some text');
});
</script>
If I use chrome, press F12 and select textbox "A" it says the ID is "input#Test_cc4abb3b-4c1c-45a4-83fc-af4a2dcb1d99_$TextField.ms-long.ms-spellcheck-true". So I tryed:
$(function () {
$('input#Test_cc4abb3b-4c1c-45a4-83fc-af4a2dcb1d99_$TextField.ms-long.ms-spellcheck-true').val('some value');
});
But sadly still not works. Maybe I am missing somthing else. I belive this should fill the selected textbox by default when I open the page.
2. How to make it based on an chage event?
I would like to trigger the set textbox "B" if the user finished writing in textbox "A". (pressing enter/tab or clicking out from the field ect...)
3. How can I insert to the textbox "B" from an other list?
For example: I would like to insert to textbox "B" from the unique column called "ID", based on the unique column "Name" where I get the "Name" value from the textbox "A"(the user write it). (Both "ID" and "Name" are columns of the other list.)
Sorry for the trivial questions, I am new to Jquery and thank you very much for your guidance!