js怎样拿到html里的内容

温润如玉 1个月前 已收到1个回答 举报

失约的一切 1星

共回答了141个问题采纳率:92.6% 评论

从js里面获取HTML 的input标签中的内容分两种:

1、获取input标签的值,方法: 根据input的name或者id获取其值,假如有:<input type='text' id='name' value=123> js中获取方法:$("#name").val();

2、获取input标签的属性内容,方法: 如有:<input type='text' id='name' value=123 ind='1'>要获取ind的值,方法:$("#name").attr("ind");

14小时前

13
可能相似的问题

猜你喜欢的问题

Copyright © 2024 微短问答 All rights reserved. 粤ICP备2021119249号 站务邮箱 service@wdace.com