Home  >  Article  >  Web Front-end  >  Ask a question about Jquery, removeAttr and attr_html/css_WEB-ITnose

Ask a question about Jquery, removeAttr and attr_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:26:281131browse

$("#fun_menu_body :checkbox").removeAttr("checked"); // 先清空$.each(result.rows, function(i, n) {$("#fun_menu_body :checkbox[value='123']").attr("checked", "true");});


This code will not be implemented according to my ideas.
My idea is to delete all the multiple boxes first, and then select the checkbox I want.

If the first line is not used in the above code (do not delete all), the checkbox I specified will be automatically selected.

So how can I delete them all first and then select the specific one?


Reply to discussion (solution)

The difference between prop and attr.

The difference between prop and attr.
Done, thank you

40d077ae805ee6de29e86d4bd958b2f4
7cd76e9f65a2646966a2cc58c5f5d166
40d077ae805ee6de29e86d4bd958b2f4

$("input[name='fun_menu_body']").removeAttr("checked");

This will remove all selected ones

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn