javascript - Whats wrong with my statement in js.php file -
trying simple html change ternary operator. page loads fine , thing missing in html #np_msg element. not sure wrong here. code snippet from
form.js.php
var toprighttext = <?php echo ($company_id==69) ? 'please add organization.' : 'please add nonprofit.'; ?> jquery('#np_msg').html(toprighttext).show();
html appears
<div class="donationrequestformright"> <div class="donationrequestinputwrap clearfix"> <label class="donationrequestlabel" for="donationrequest_nonprofit"> organization <span>*</span> </label> <input type="text" class="donationrequestinputbox correct" name="general[np_name]" id="donationrequest_nonprofit" value=""> <input type="hidden" name="general[np_id]" id="np_id" value="0" style="display:block;"> <div id="np_msg" style="display: none;"></div> <p style="float: right;font-size: 14px;font-weight: bold;">can't find organization? <a href="javascript:void(0);" id="addnp">add here</a>.</p> </div> <div class="donationrequestinputwrap last clearfix"> <input type="hidden" name="drop_np_contact_id" id="drop_np_contact_id" value="0"> <input type="hidden" name="general[np_contact_id]" id="np_contact_id_final" value="0"> <label class="donationrequestlabel" for="donationrequest_contact"> contact information <span>*</span></label> <div id="contact_div"> </div> <div id="np_con_load" style="float: right;"></div> <p style="float: left;font-size: 13px;font-weight: normal;"> click <a href="javascript:void(0);" id="addnpcontact">here</a> add contact information. </p> <div id="contact_msg" style="display: none;"></div> </div> <div class="darkgreybox clearfix" id="details_info" style="display: none;"></div> </div>
add quotes var toprighttext = "<?php echo ($company_id==69) ? 'please add organization.' : 'please add nonprofit.'; ?>"; jquery('#np_msg').html(toprighttext).show();
Comments
Post a Comment