Wright-Geek
Wright-Geek

Reputation: 395

Select the surrounding tag in jquery

I have $(this) pointing at my input box but cannot seem to reference the surrounding span to add a red border.

<span id="hdr-su_name" class="eforminput">
    <input type="text" size="30" id="su_name" name="su_name">
</span>

I have tried this but does not work:

$(this).parent().css({'border-color':'1px solid #ff0000'}); 

Any help much appreciated !

Upvotes: 2

Views: 292

Answers (1)

volkan er
volkan er

Reputation: 1012

$(this).parent().css({'border':'1px solid #ff0000'}); 

Upvotes: 3

Related Questions