Value in the input element is not displayed - (although value is being loaded correctly) - Jquery

2

Hello

I'm returning an object through ajax and assigning the values to their fields.

Usingthetitlefieldasanexample:

$('#txt_titulo').val(objeto_menu.titulo);

However,InoticedonethingwhenIopenedthebrowserconsole.

<inputtype="text" id="txt_titulo" class="form-control input-sm titulo lower valid" name="titulo" tabindex="4" autocomplete="off" placeholder="Título">

Although the field is correctly populated with the value coming from the server, I did not find in the element the value="Menu".

So, you should find something like:

<input type="text" id="txt_titulo" class="form-control input-sm titulo lower valid" name="titulo" tabindex="4" autocomplete="off" value="Menu">

I'm changing some things on the front end, and I'm having a problem because I need this value .

Does anyone know why it is not displayed?

    
asked by anonymous 10.05.2018 / 22:16

1 answer

1

Just completing my comment.

If you want to see this attribute in the Console (This is not necessary).

You can do this:

$('#txt_titulo').attr('value', objeto_menu.titulo);

But the most common is to use the way you did and not worry about it not being visible on the console.

Because you can check the value of it this way:

$('#txt_titulo').val();
    
10.05.2018 / 22:38