javascript - validate iframe input field from outside the iframe submit button - jquery validator plugin -
i have 1 html structure
<form id="myvalidation"> <iframe> <form id="insidevalidation"> <input type="text" name="myname" id="myname" /> </form> </iframe> <input type="submit" /> </form>
i need validate input field inside iframe
not able find name
validation outside iframe.
"myname": { required:true, validemail:true //onlynumeric:true },
not sure how myname
from outside iframe. please
as long input
has name
, not need know name
declare rules using .rules()
method.
after initializing plugin .validate()
, can attach .rules()
method selector.
$('#insidevalidation').validate({ // initialize plugin // other options, etc. .... }); $('#insidevalidation input').rules('add', { // attach these rules first input element required: true, validemail: true });
also note submit button outside of form
you're trying validate it's not going work expected.
however, answer assumes can use plugin on form
within iframe
. don't know, , cannot tested within snippet or jsfiddle since iframe
rendering empty.
Comments
Post a Comment