0

I am using an OOTB field entitled Email that does not seem to be working. I have a really simple code that on change of the field value a pop up will return that field value:

$(document).ready(function(){
   var textarea=$(":input[title='Email']");
          textarea.blur(function(){            
              alert(textarea);         
         });
});

I have looked in the HTML code on the form and it returned this:

<tr>
    <td nowrap="true" valign="top" width="113px" class="ms-formlabel"> 
        <h3>class="ms-standardheader">
             <nobr>Email Address<span class="ms-accentText" title="This is a required field."> *</span></nobr>
        </h3>
    </td>
    <td valign="top" width="350px" class="ms-formbody">
    <!-- FieldName="Email Address"
         FieldInternalName="Email"
         FieldType="SPFieldText"
      -->
    <span dir="none"><input type="text" value="" maxlength="255" id="Email_fce16b4c-fe53-4793-aaab-b4892e736d15_$TextField" title="Email Address Required Field" class="ms-long ms-spellcheck-true"><br></span>
    </td>

It seems the out of the box solution does not work. Any Ideas?

0

Try this

jQuery(document).ready(function(){
    jQuery("input[id^='Email']").blur(function() {
      alert( "Event Fired" );
    });     
});

Your code didn't worked because jQuery was trying to select input element which has title equal to Email. But as you can see rendered HTML doesn't have any such element.

My fix was to find input element which has Id starts with Email.

  • You Sir are a gentleman and a scholar. Thank you so much! – Tom Apr 30 '15 at 15:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.