set value in a input field with javascript

by 5 replies
6
How would you set the value in a form input field with javascript. I tried by my own but it is not working. can anyone correct it.

Incorrect Coding:

#programming #field #input #javascript #php learning help #php training #set
  • Edit fiddle - JSFiddle

    Seem to work fine, you probably have some other issue in your code, unrelated to the one which you have posted. can you create a fiddle so we all be able to see?
    • [1] reply
    • $("input[name='fieldname']").val("value");
      • [1] reply
  • Your code looks alright, there must be other code that causing error. Post your URL so we can take a look.
  • I believe your input is incomplete. It should be...

    <input type="text" id="name" value="some value">

    Best regards,
    Steve Yakim

Next Topics on Trending Feed