Reputation: 6587
I have a button that has some predefined CSS. With this button i have created an action button and a textarea.
Whenever i write some CSS in textarea then it should be added to existing button's CSS when submitting this CSS by action button.
I tried this-
jQuery-
$(function(){
$('.add').click(function(){
var custom=$('.textarea').val();
$('.button').css(custom);
});
});
But it doesn't seem to be working, How can i do this?
Is iframe
Needed here?
Upvotes: 0
Views: 194
Reputation: 4650
Maybe try this
$(function(){
$('.add').click(function(){
var custom=$('.textarea').val().split(',');
$('.button').css(custom[0],custom[1]);
});
});
pass in background,red
in text area
Upvotes: 1