Append javascript content inside gwt dialogBox - javascript

I have a js function that shows some content in a div. So I create this div in my html panel and when calling js function from my gwt code the function works fine...(JNSI)
The problem is when I want to show this content in a dialogBox. So what I do is this: I create the dialogBox using uibinder and I create a div inside as follows:
<g:HTMLPanel ui:field="hmtl_panel">
<div ui:field="show_to_this_div">
</div>
</g:HTMLPanel>
and in the js I use "document.getElementById('show_to_this_div')" as when the div was in the html panel...But nothing happens :-(!

I think you should be using $wnd.document

Related

how to wrap two divs inside another div using css in html

i have a website in opencart, the homepage is default where it shows a code like
<div id="content"> <?php echo $content_top; ?></div>
I added my own HTML code inside it like below:
<div class="created">
this is some content
</div>
now the content I created is coming in the footer, am not able to find the default code for the page, I want the content to be placed below the slider in the page, so I created a parent div main-div for both the slider and my content, but as I don't have the code to the homepage i am not able to place the slider and my content inside the main div, I only know the class of the slider slider-wrap, is there anyway to force the two classes inside the main-div using css or javascript. please help. thanks in advance

jquery append a href materialize modal not working

hello i have this problem where i need to append a href tag with materialize modal inside it
so this is the code
<a href='#modalcreatechecklistitem' class='modal-trigger'>Add an item</a>
i have no problem when i just put it in my html
however, when i tried to append using jquery
$("#ajaxChecklist").append("<a href='#modalcreatechecklistitem' class='modal-trigger'>Add an item</a>");
it is not working
UPDATE :
class modal-trigger is not loaded, is this from jquery or my css?
it is working fine when i code in my html file
ANSWER:
jquery doesnt allow you to append a materialize class to an element.
To do this action, you need to re-initialize the materialize element or function
in this case, i did a function on the #modalcreatechecklistitem
the funtion will re-intialize the materialize modal and open the modal
you working is working fine, i just checked in fiddle also
https://jsfiddle.net/jvk3/8nfbxa1p/1/
may be you placed inside the table div or similar to parent
Two important questions:
1 - Is it code running in document.ready?
2 - Is there element with this id ajaxChecklist on the page?

Set div id in javascript based on modal content

On my homepage, index.html, I have a div for a rating system like this
<div class="srtgs" id="rt_??"></div>
Then in my javascript I have a function that generates modal content for each feature in an array, within this I need each modal to have the div above like this
<div class="srtgs" id="rt_<feature.properties.name>"></div>
I tried to change the id in javascript which works but then on page refresh when it loads the modal it is back to rt_?? so it does not get the correct ratings from the DB
Any help is appreciated cheers
Create a JS function with your code for a div id.
Then Use:
<body onload="javascriptFn()">
Change "javascriptFn()" to your function name.

not showing data using thickbox tb_inline

I am using, thickbox in Joomla, have included jquery and thickbox files, and when I use iframe or ajax then every thing shows fine while if I try to show inline content in thickbox, it doesnot show any thing. Following is my code:
Show hidden modal content.
<div style="display:none" id="hiddenModalContent">This is the div that I want to show</div>
So where the problem is? I am using it in Joomla. It shows popup but nothing inside it, and it is really strange that this is not working in my code while working on thick box demo with same code, so please tell whatever you know.
thanks
This will work for you;
you have to warp content into another HTML element within the hiddin div:
Show hidden modal content.
<div style="display:none" id="hiddenModalContent">
<div>This is the div that I want to show</div>
</div>
did you try wrapping your content ("This is the div that I want to show") inside a blank div?
eg:
<div style="display:none" id="hiddenModalContent"><div>This is the div that I want to show</div></div>

javascript using a div created in script with plugin

I have created a div using jquery and put some text in it:
var newdiv=$('<div id="content">').append('some text here');
$("#wrapper").append(newdiv);
Now I am trying to use the plugin masonry on the div.
I have added the following just below the above that creates the div:
$("#wrapper").masonry();
I have checked and jquery and masonry are loading correctly.
The new div called content shows in firebug correctly, but the masonry part is not doing anything to the new "content" div.
Any ideas?
Perhaps you should try adding 'appended':
var newdiv=$('<div id="content">').append('some text here');
$("#wrapper").append(newdiv);
$("#wrapper").masonry('appended', newdiv);
There's an append/prepend example here http://masonry.desandro.com/demos/adding-items.html

Categories