cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
737
Views
0
Helpful
1
Replies

Loading html input with user.getId() (for example)

rls1234
Level 1
Level 1

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

1 Accepted Solution

Accepted Solutions

dekwan
Cisco Employee
Cisco Employee

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

View solution in original post

1 Reply 1

dekwan
Cisco Employee
Cisco Employee

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