开发者

get an input with certain name from iframe jquery

开发者 https://www.devze.com 2023-03-21 19:58 出处:网络
I have a form inside an iframe, now I want to get the input with certain name. The id of my iframe is \"myFrame\". I was able to take out the inputs inside the iframe by $(\"#myFrame\").cont开发者_如何

I have a form inside an iframe, now I want to get the input with certain name. The id of my iframe is "myFrame". I was able to take out the inputs inside the iframe by $("#myFrame").cont开发者_如何学Pythonents().find("input") but i want the input by name, so i did $("#myFrame").contents().find("input[name=input_id]") but with failure. Can anybody help me with this?


If input_id is a variable, you need to concatenate the input_id:

$("#myFrame").contents().find("input[name='" + input_id + "']");


Have you tried (using double quotes):

   $("#myFrame").contents().find('input[name="input_id"]')

and when you say that you took out the inputs with:

   $("#myFrame").contents().find("input")

did you check that the input you wanted was inside that collection?

0

精彩评论

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

关注公众号