question

superTaylorfansLiu-3009 avatar image
0 Votes"
superTaylorfansLiu-3009 asked yogyogi commented

How can I get the <input /> value in a blazor razor page after it rendered completely by using javascript?

83624-mycode.jpg

I wrote this in my code, one of my test razor page.
<input value= "3"/>


83612-result.jpg

And after I run the project, in the WebPage I has saw the value is 3. But I saw in the DOM , it doesn't have value attribute.

So when I just use the DOM what I saw to create a html and open it, I could not see the value 3.

How can I get the DOM that include the input value;

Look forward your reply;

thanks


dotnet-aspnet-core-blazor
mycode.jpg (26.5 KiB)
result.jpg (41.9 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

JerryCai-MSFT avatar image
0 Votes"
JerryCai-MSFT answered yogyogi commented

Hi,superTaylorfansLiu

Do you mean you can't render the number 3 in html?

Where did you get the number 3? you can set a parameter to put the number in and then it can be passed to other place, like this demo:

z6EhW.png

Result:

HeAt4.gif

About the model binding in blazor, you can check the official tutorial below:

data-binding

Best Regards,
Jerry Cai


If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

No! What I mean was that the value what I set for the input tag, I could see it after rendered completely, but I known that the value could not be seen in the rendered HTML, So did I has any ways to see the value int the HTML?

83900-image.png


0 Votes 0 ·
image.png (252.9 KiB)
JerryCai-MSFT avatar image JerryCai-MSFT superTaylorfansLiu-3009 ·

Hi,@superTaylorfansLiu-3009 That demo is the normal way to get the data, use a parameter as a container. If you want to know why the value does not rendered when @oninput exists, this is a blazor design, you can also try github:issues

0 Votes 0 ·

Thanks for your reply, I known this is a blazor design and I just not sure that did it has any paramters to let it show.

I will try to list the issue at github issue.

Thanks for your help.



1 Vote 1 ·
Show more comments