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 mynamefrom 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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -