मेरे पास निम्न कोड है।
$(document).ready(function(){
$('#listing img')
.attr('width', 250)
.removeAttr('height').removeAttr('align').removeAttr('style')
.wrap('<p />');
});
क्या कई विशेषताओं को हटाने का एक अधिक कुशल तरीका है?
मेरे पास निम्न कोड है।
$(document).ready(function(){
$('#listing img')
.attr('width', 250)
.removeAttr('height').removeAttr('align').removeAttr('style')
.wrap('<p />');
});
क्या कई विशेषताओं को हटाने का एक अधिक कुशल तरीका है?
जवाबों:
हाँ :
.removeAttr('height align style')
से प्रलेखन :
संस्करण 1.7 के रूप में, यह एक अंतरिक्ष-अलग-अलग विशेषताओं की सूची हो सकती है।
हां, आप इसे इस तरह से हटा सकते हैं:
$('#listing img').removeAttr('height align style');
आप उन विशेषताओं को इस प्रकार जोड़ सकते हैं:
$('#listing img').attr({ height: "20", align: left }).css({ color: red, text-align: center });