开发者

get an input with certain name from iframe jquery

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜