I'm using below javascript to set value to cell in a tabular form.
<script type="text/javascript">
function eventListener(pThis)
{
$('input[name="f04"]').change(function(){
var that = this;
var vRow = "f10_"+pThis.id.substr(pThis.id.indexOf('_')+1);
$.post("wwv_flow.show",
{p_request : "APPLICATION_PROCESS=GET_AMOUNT",
p_flow_id : $v("pFlowId"),
p_flow_step_id : $v("pFlowStepId"),
p_instance : $v("pInstance"),
x01 : $(this).val()
},
function(data){
$('input[id="f10_0002"]').val(data);
},
"text"
);
});
}
</script>
I need to use value in var vRow instead of f10_0002 in $('input[id="f10_0002"]').val(data);.
I have tried with $('input[id=vRow]').val(data); and $('input[id='"'+vRow+'"']').val(data);
But doesn't work. javascript is not worked in these situations. but $('input[id="f10_0002"]').val(data); is worked.
how could i use value in var vRow for this ?
$("input[id=" + value + "]")...just use$("#" + value)#is the equivalent of matching an element by ID. That is its purpose in jQuery selection. If you look at the jQuery selectors page ( api.jquery.com/category/selectors ), you'll see there are several special characters to help with selecting elements. As I said,#is for ID,.is for class, etc. So instead of having jQuery parse the string "input[id=value]" and do a lot of extra processing, you can help jQuery do it more efficiently by simply using#. IDs are supposed to be unique and the methoddocument.getElementById, which I'm sure jQuery uses internally, is "better"