开发者

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]\"]";
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜