12-07-2016 11:04 AM
I am using the Learning Sample. In the .js document there are entries like: $("#userId").text(user.getId());
I am trying to load the ID into an input object: <td <input type="text" id="userid" value=""></td>
I can successfully load the value into other objects, like simple <p id="userId"></p>
Could someone advise the correct syntax?
Thanks.
Roy
Solved! Go to Solution.
12-07-2016 11:35 AM
Hi,
The $("xxxxxx") is jQuery syntax. This site might help for you to understand it better: http://www.w3schools.com/jquery/jquery_syntax.asp
I am trying to load the ID into an input object: <td <input type="text" id="userid" value=""></td>
There are a couple of things,
1) You are missing a > after <td
2) The id you have is "userid" while the jQuery is userId. Capitalization matters.
3) Since it is an input field, you want to change the value attribute, so that would be .val(). See doc here: jQuery Set Content and Attributes. So, it would be $("#userId").val(user.getId())
Thanx,
Denise
12-07-2016 11:35 AM
Hi,
The $("xxxxxx") is jQuery syntax. This site might help for you to understand it better: http://www.w3schools.com/jquery/jquery_syntax.asp
I am trying to load the ID into an input object: <td <input type="text" id="userid" value=""></td>
There are a couple of things,
1) You are missing a > after <td
2) The id you have is "userid" while the jQuery is userId. Capitalization matters.
3) Since it is an input field, you want to change the value attribute, so that would be .val(). See doc here: jQuery Set Content and Attributes. So, it would be $("#userId").val(user.getId())
Thanx,
Denise
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide