Home > Web Front-end > HTML Tutorial > 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
Release: 2016-06-24 12:26:28
Original
1173 people have browsed it

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


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




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

This will remove all selected ones

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template