 <p>What you have would work (if I understand you correctly) except that the class-selector begins with a dot (<code>.</code>) instead of a hash (<code>#</code> -- which selects by id, not class-name), so try:</p> <pre><code>jQuery("div:contains('myfield')").parent().find('.css_class').val('thisistheclass'); </code></pre>