Jquery Selector
I'm stuck here with a problem that I can't figure out. I want to change the value of an input field with jquery. I don't understand why it's not working.
<script>
$.noConflict();
jQuery(document).ready(function(){
theimg = "[name=img\\[1\\]\\[mark\\]]";
jQuery(theimg).attr("value", '1');
});
</script>
<input type="text" name="img[1][mark]" value="0" />开发者_JAVA技巧
The fade works, but I cannot get the input fields to change their value.
Use $.val() instead.
$(theimg).val(1);
Also try this for selecting the image:
theimg = "input[name=\"img[2][mark]\"]";
精彩评论