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

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

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

android - How to create dynamically Fragment pager adapter -