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?
精彩评论