(answers aggregated into another question)
The following jquery 1.3.2 code works:
<input type="select" value="236434" id="ixd" name='ixd' />
<script>
console.log( $('#ixd') );
console.log( $("input[name='ixd']") );
</script>
Console shows:
[input#ixd 236434]
[input#ixd 236434]
However setting the input to "hidden" prevents the selectors working. Any clues?
<input type="hidden" value="236434" id="ixd" name='ixd' />
<script>
console.log( $('#ixd') );
console.log( $("input[name='ixd']") );
</script>
Console shows:
[]
[]
Not sure why that would be failing. I do the same thing at work on a regular basis, and it works regardless of the formfield being hidden or not.
Perhaps try this:
<input type="hidden" value="236434" id="ixd" name='ixd' />
<script>
console.log($("#xid").val())
</script>
That will get you the value of the hidden field. To get the value out of a form field, the .val()
method needs to be used.