0

The code of the text field is:

<s:iterator value="paramSimple" var="param" status="iteratorStatus">
<tr>
<td>
<input type="text" text_id="<s:property value="#iteratorStatus.index" />" value= "<s:property value=" #param.value.split(':')[1] " />"/>
</td>
</tr>
</s:iterator>

How do i access the value of the text field in JS function?

I tried using

$("input[text_id='1']")

but it shows the input element instead of the value

1
  • inspect element and check what is actually rendered on html. Commented Jul 17, 2021 at 3:21

1 Answer 1

2

you can access the value of an input by using .value

something like this

<input type="text" id="input"> 
const input = document.getElementById("input");
console.log(input.value); //console logs the value of the input

console.log($("#input").value); //jquery

but obviously you can target it not only with ids, in this case you want to target it with text_id so just add .value behind it to target the value

$("input[text_id='1']").value
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.