Helo I use this code:
cur = $('input:radio');
cur.wrap('<span class="customRadio"></span>');
what i must to do to acces the '.customRadio' element? I already tried:
cur.parent('.customRadio')
and
$('.customRadio')
Helo I use this code:
cur = $('input:radio');
cur.wrap('<span class="customRadio"></span>');
what i must to do to acces the '.customRadio' element? I already tried:
cur.parent('.customRadio')
and
$('.customRadio')
Hello,
And by using closest
?
var custom = cur.closest(".customRadio");
wrapper = $('<span class="customRadio"></span>')
Then wrapper is a span element and you can use it in jQuery:
cur.wrap(wrapper)
And you have access to the wrapper:
EDIT: Sorry, you can only access the wrapper before you wrap it around your target element. The actual element wrapped around the target is not the one you have access to.
// Effects the span that will be wrapped:
wrapper.css('color', 'red')
cur.wrap(wrapper)
// Doesn't effect the span that was wrapped:
wrapper.css('border', '1px solid green')
it works fine for me http://jsfiddle.net/QD35Z/
<div id="mah">hello</div>
var $parent = $('#mah').wrap('<span id="test"></span>').parent();
alert($parent.attr("id"));